icinga-powershell-framework/lib/core/tools/Get-IcingaUnixTime.psm1
2021-01-21 15:51:24 +01:00

14 lines
327 B
PowerShell

function Get-IcingaUnixTime()
{
param(
[switch]$Milliseconds = $FALSE
);
if ($Milliseconds) {
return ([int64](([DateTime]::UtcNow) - (Get-Date '1/1/1970')).TotalMilliseconds / 1000);
}
return [int][double]::Parse(
(Get-Date -UFormat %s -Date (Get-Date).ToUniversalTime())
);
}