Use New-TimeSpan to calculate total elapsed time

Fixes #2797

Signed-off-by: Martin Kemp <me@martinke.mp>
This commit is contained in:
Martin Kemp 2022-12-19 10:13:34 +00:00
parent 691addb95c
commit 328f4b3073
No known key found for this signature in database
GPG Key ID: BEB00D3D377894F0

9
vendor/profile.ps1 vendored
View File

@ -5,7 +5,7 @@
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
# !!! Use "%CMDER_ROOT%\config\user_profile.ps1" to add your own startup commands
$CMDER_INIT_START = $(Get-Date -UFormat %s)
$CMDER_INIT_START = Get-Date
# Compatibility with PS major versions <= 2
if (!$PSScriptRoot) {
@ -224,5 +224,8 @@ if ( $(Get-Command prompt).Definition -match 'PS \$\(\$executionContext.SessionS
Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly
}
$CMDER_INIT_END = $(Get-Date -UFormat %s)
Write-Verbose "Elapsed Time: $(get-Date) `($($CMDER_INIT_END - $CMDER_INIT_START) total`)"
$CMDER_INIT_END = Get-Date
$ElapsedTime = New-TimeSpan -Start $CMDER_INIT_START -End $CMDER_INIT_END
Write-Verbose "Elapsed Time: $($ElapsedTime.TotalSecond) seconds total"