It seems the time returned by clock_gettime(CLOCK_UPTIME) doesn't get updated on resume - in other words, when you reboot, then suspend to ram, then wait an hour and resume, the uptime, as shown by uptime(1), won't account for that hour. This is different from eg OSX.
(In reply to Edward Tomasz Napierala from comment #0) But not from e.g. Linux? :)
I can see arguments for and against including the period during suspend-to-RAM in uptime, so agree with avg that we'd want to survey other OSes and give careful consideration to this change before making it.
I've asked around (thanks, Ar!), and it seems the time spent while suspended is accounted for under Linux too (NixOS, 4.19.30).
I've tried to track it down, but went nowhere - I don't quite understand how the timers work. One thing I've noticed is that CLOCK_UPTIME seems to be computed from current time and the boot time; what happens is that after resuming, the boottime (eg 'sysctl kern.boottime') moves forward.
(In reply to Andriy Gapon from comment #1) > But not from e.g. Linux? :) FWIW, if you install `sysutils/coreutils' port/package, you can observe the difference as demonstrated below (quoted from my laptop which I put to sleep, albeit irregularly): > $ guptime > 10:26:42 up 5 days 8:10, 7 users, load average: 0.24, 0.28, 0.63 > $ uptime > 10:26 up 4 days, 22:25, 16 users, load averages: 0,30 0,29 0,63