Skip to content

Commit

Permalink
Use epoch time for Cobertura and JaCoCo
Browse files Browse the repository at this point in the history
  • Loading branch information
fflaten committed Jul 12, 2024
1 parent c643f5e commit 80f2120
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/functions/Coverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 80f2120

Please sign in to comment.