mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Adds support for ms on Unix Time
This commit is contained in:
parent
7448e9806e
commit
a1e6a780af
2 changed files with 10 additions and 0 deletions
|
|
@ -13,6 +13,8 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
||||||
|
* [#193](https://github.com/Icinga/icinga-powershell-framework/pull/193) Adds optional support for adding milliseconds to `Get-IcingaUnixTime` with the `-Milliseconds` argument for more detailed time comparison
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
||||||
* [#188](https://github.com/Icinga/icinga-powershell-framework/pull/188) Removes hardcoded zones `director-global` and `global-zones` which were always set regardless of user specification. This fix will ensure the user has the option to add or not add these zones
|
* [#188](https://github.com/Icinga/icinga-powershell-framework/pull/188) Removes hardcoded zones `director-global` and `global-zones` which were always set regardless of user specification. This fix will ensure the user has the option to add or not add these zones
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,13 @@
|
||||||
function Get-IcingaUnixTime()
|
function Get-IcingaUnixTime()
|
||||||
{
|
{
|
||||||
|
param(
|
||||||
|
[switch]$Milliseconds = $FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($Milliseconds) {
|
||||||
|
return ([int64](([DateTime]::UtcNow) - (Get-Date '1/1/1970')).TotalMilliseconds / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
return [int][double]::Parse(
|
return [int][double]::Parse(
|
||||||
(Get-Date -UFormat %s -Date (Get-Date).ToUniversalTime())
|
(Get-Date -UFormat %s -Date (Get-Date).ToUniversalTime())
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue