diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/VcpkgPowershellUtils.ps1 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 63da1a508..722d337ca 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -195,4 +195,29 @@ function vcpkgInvokeCommandClean() $ec = $process.ExitCode Write-Verbose "Execution terminated with exit code $ec." return $ec +} + +function vcpkgFormatElapsedTime([TimeSpan]$ts) +{ + if ($ts.TotalHours -ge 1) + { + return [string]::Format( "{0:N2} h", $ts.TotalHours); + } + + if ($ts.TotalMinutes -ge 1) + { + return [string]::Format( "{0:N2} min", $ts.TotalMinutes); + } + + if ($ts.TotalSeconds -ge 1) + { + return [string]::Format( "{0:N2} s", $ts.TotalSeconds); + } + + if ($ts.TotalMilliseconds -ge 1) + { + return [string]::Format( "{0:N2} ms", $ts.TotalMilliseconds); + } + + throw $ts }
\ No newline at end of file |
