Merge pull request #259 from Icinga:fix/properly_format_time_span_string_values

Fix: Missing rounding for time span values

We should round time span values converted to string to transform `22,8934057h` to `22,89h` for example
This commit is contained in:
Lord Hepipud 2021-05-29 00:08:58 +02:00 committed by GitHub
commit 53f75e8252
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@ function ConvertFrom-TimeSpan()
return (
[string]::Format(
'{0}d',
$TimeSpan.TotalDays
([math]::Round($TimeSpan.TotalDays, 2))
)
);
}
@ -20,7 +20,7 @@ function ConvertFrom-TimeSpan()
return (
[string]::Format(
'{0}h',
$TimeSpan.TotalHours
([math]::Round($TimeSpan.TotalHours, 2))
)
);
}
@ -28,7 +28,7 @@ function ConvertFrom-TimeSpan()
return (
[string]::Format(
'{0}m',
$TimeSpan.TotalMinutes
([math]::Round($TimeSpan.TotalMinutes, 2))
)
);
}
@ -36,7 +36,7 @@ function ConvertFrom-TimeSpan()
return (
[string]::Format(
'{0}s',
$TimeSpan.TotalSeconds
([math]::Round($TimeSpan.TotalSeconds, 2))
)
);
}