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) { 
            $global:TimeTrack = @{
                Start = Get-Date
            }
        }

        if ($Stop) { 
            $global:TimeTrack.Stop = Get-Date
            $global:TimeTrack.RunTime = $global:TimeTrack.Stop - $global:TimeTrack.Start
            $RoundedMinutes = [math]::Round((($global:TimeTrack.RunTime).TotalMinutes), 2)
            return $RoundedMinutes
        }
    
    }
}

Export-ModuleMember -Function *
Write-Verbose "Import-END| [$($FunctionScriptName)]"