From c6ae93cb7ba14c99436cd20b431ed95bfa3ee61c Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Tue, 20 Aug 2019 17:01:20 +0200 Subject: [PATCH] Added function to convert seconds to runtime --- lib/core/tools/ConvertFrom-TimeSpan.psm1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/core/tools/ConvertFrom-TimeSpan.psm1 diff --git a/lib/core/tools/ConvertFrom-TimeSpan.psm1 b/lib/core/tools/ConvertFrom-TimeSpan.psm1 new file mode 100644 index 0000000..0369ece --- /dev/null +++ b/lib/core/tools/ConvertFrom-TimeSpan.psm1 @@ -0,0 +1,18 @@ +Import-IcingaLib core\tools; + +function ConvertFrom-TimeSpan() +{ + param( + $Seconds + ); + + $TimeSpan = [TimeSpan]::FromSeconds($Seconds); + + return [string]::Format( + 'Days: {0} Hours: {1} Minutes: {2} Seconds: {3}', + $TimeSpan.Days, + $TimeSpan.Hours, + $TimeSpan.Minutes, + $TimeSpan.Seconds + ); +}