From 80f212012e402ed748b9970c68286e54c860554f Mon Sep 17 00:00:00 2001 From: Frode Flaten <3436158+fflaten@users.noreply.github.com> Date: Fri, 12 Jul 2024 21:52:26 +0000 Subject: [PATCH] Use epoch time for Cobertura and JaCoCo --- src/functions/Coverage.ps1 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/functions/Coverage.ps1 b/src/functions/Coverage.ps1 index 4bdc88c87..ee184c6c0 100644 --- a/src/functions/Coverage.ps1 +++ b/src/functions/Coverage.ps1 @@ -806,9 +806,8 @@ function Get-JaCoCoReportXml { return [string]::Empty } - $now = [DateTime]::Now - $nineteenSeventy = [DateTime]"01/01/1970" - [long] $endTime = [math]::Floor(($now - $nineteenSeventy).TotalMilliseconds) + # Report uses unix epoch time format (milliseconds since midnight 1/1/1970 UTC) + [long] $endTime = [System.DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds() [long] $startTime = [math]::Floor($endTime - $TotalMilliseconds) $folderGroups = $CommandCoverage | & $SafeCommands["Group-Object"] -Property { @@ -1042,9 +1041,8 @@ function Get-CoberturaReportXml { return [string]::Empty } - $now = [DateTime]::Now - $nineteenSeventy = [DateTime]"01/01/1970" - [long] $endTime = [math]::Floor(($now - $nineteenSeventy).TotalMilliseconds) + # Report uses unix epoch time format (milliseconds since midnight 1/1/1970 UTC) + [long] $endTime = [System.DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds() [long] $startTime = [math]::Floor($endTime - $TotalMilliseconds) $commonRoot = Get-CommonParentPath -Path $CoverageReport.AnalyzedFiles