TimeTrack--v1-0.psm1
$FunctionScriptName = "TimeTrack--v1-0" Write-Verbose "Import-Start| [$($FunctionScriptName)]" function TimeTrack { [CmdletBinding()] Param( [Parameter()][switch]$Start, [Parameter()][Alias('Measure')][switch]$Stop #todo: Param set - accept only one ) Process { $SelfIdentifier = "TimeTrack" Write-Verbose "[$($SelfIdentifier)] TimeTracker action" if ($Start) { $script:TimeTrack = @{ Start = Get-Date } } if ($Stop) { $script:TimeTrack.Stop = Get-Date $script:TimeTrack.RunTime = $script:TimeTrack.Stop - $script:TimeTrack.Start $RoundedMinutes = [math]::Round((($script:TimeTrack.RunTime).TotalMinutes), 2) return $RoundedMinutes } } } Export-ModuleMember -Function * Write-Verbose "Import-END| [$($FunctionScriptName)]" $TimeTrack = @{ Start = Get-Date } [math]::Round((((Get-Date) - $TimeTrack.Start).TotalMinutes), 2) |