nix-output-monitor icon indicating copy to clipboard operation
nix-output-monitor copied to clipboard

Build time counter should be paused while system is suspended

Open alyssais opened this issue 2 years ago • 0 comments

I had some builds running while my computer was suspended for several hours. When I woke it up, nom was showing very high build times for things that should have finished quickly, presumably because it was counting time that had elapsed while the system was suspended.

This sort of issue is usually caused by using wall clock time (CLOCK_REALTIME) instead of the monotonic clock (CLOCK_MONOTONIC), which at least on Linux does not increment while the system is suspended. CLOCK_REALTIME is also affected by system time changes, so if that is what nom is using, it would be possible to have negative build times if the clock went back (e.g. DST).

There seem to be Haskell packages for using the monotonic clock.

alyssais avatar Jul 12 '22 07:07 alyssais