Skip to content

Commit

Permalink
wb: fix faulty calculation resulting div-by-zero on Darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmeier committed Aug 24, 2022
1 parent 9b5fe60 commit 8e9e035
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trace-resources/src/Cardano/Logging/Resources/Darwin.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ readResourceStatsInternal = getProcessID >>= \pid -> do
nsToCenti :: GhcStats.RtsTime -> Word64
nsToCenti = fromIntegral . (`div` 10000000)
timeValToCenti :: TIME_VALUE_T -> Word64
timeValToCenti tv = 10000 `div` (usFromTimeValue tv)
timeValToCenti tv = usFromTimeValue tv `div` 10000

usFromTimeValue :: TIME_VALUE_T -> Word64
usFromTimeValue (TIME_VALUE_T s us) = s * 1000000 + us

0 comments on commit 8e9e035

Please sign in to comment.