mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 16:53:02 +08:00
Add vcpkgFormatElapsedTime in powershell side
This commit is contained in:
parent
6741689094
commit
2bc105cd95
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user