Improve the time measurement

This commit is contained in:
Markus Fleschutz
2021-04-15 08:41:37 +02:00
parent edb2bc56e6
commit 2b7b6fdf1a
6 changed files with 17 additions and 20 deletions

View File

@ -10,7 +10,7 @@ param($ParentDir = "$PWD")
try {
"Pulling updates for Git repositories under $ParentDir ..."
$StartTime = get-date
$StopWatch = [system.diagnostics.stopwatch]::startNew()
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
set-location "$ParentDir"
@ -31,8 +31,7 @@ try {
$Count++
}
$Elapsed = new-timeSpan -start $StartTime -end (get-date)
write-host -foregroundColor green "OK - pulled updates for $Count Git repositories under $ParentDir in $($Elapsed.seconds) second(s)"
write-host -foregroundColor green "OK - pulled updates for $Count Git repositories under $ParentDir in $($StopWatch.Elapsed.Seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"