#18100: Haiku has an inconsistent uptime counter
--------------------------------+--------------------------
Reporter: haikupr | Owner: nobody
Type: bug | Status: new
Priority: normal | Milestone: Unscheduled
Component: System/Kernel | Version: R1/beta4
Keywords: timekeeping uptime | Blocked By:
Blocking: | Platform: x86-64
--------------------------------+--------------------------
On both Haiku R1/beta3 and hrev56595, the uptime counter as reported by
uptime(1) and AboutSystem exhibit an inconsistent behavior. For example, a
system booted circa 16:19:37 give at 16:23:06 an uptime of 4 hours and 38
minutes, this is obviously incorrect.
I initially though this could be due to a drifting clock, so I logged the
value of the counter at boot time for a few days and found surprising
values:
{{{
2022-11-20T07:25:21+01:00 07:25:21 up 2:39, 0 users
2022-11-20T07:30:37+01:00 07:30:37 up 2:44, 0 users
2022-11-20T07:33:50+01:00 07:33:50 up 2:47, 0 users
2022-11-20T07:35:47+01:00 07:35:47 up 2:49, 0 users
2022-11-20T07:36:20+01:00 07:36:20 up 2:50, 0 users
2022-11-20T08:02:11+01:00 08:02:11 up 3:16, 0 users
2022-11-21T07:19:51+01:00 07:19:51 up 1:17, 0 users
2022-11-21T07:21:28+01:00 07:21:28 up 1:19, 0 users
2022-11-22T06:45:39+01:00 06:45:39 up 0:01, 0 users
2022-11-22T06:49:36+01:00 06:49:36 up 0:05, 0 users
2022-11-22T10:16:27+01:00 10:16:27 up 3:32, 0 users
2022-11-23T06:45:27+01:00 06:45:27 up 0:01, 0 users
2022-11-24T08:26:08+01:00 08:26:08 up 0:01, 0 users
2022-11-24T13:44:56+01:00 13:44:56 up 5:20, 0 users
2022-11-25T12:16:57+01:00 12:16:57 up 1:49, 0 users
2022-11-25T19:03:29+01:00 19:03:29 up 8:35, 0 users
2022-11-26T16:19:37+01:00 16:19:37 up 4:34, 0 users
}}}
The log above was produced by the following script:
{{{
echo >~/config/settings/boot/launch/track-boot-uptime <<EOF
#!/bin/sh
echo `date --iso-8601=seconds` `uptime` >>/var/log/boot-uptime.log
EOF
chmod +x ~/config/settings/boot/launch/track-boot-uptime
}}}
It looks like the value of the counter is usually kept across reboots and
is sometime reset to zero or another seemingly random but quite small
value for no obvious cause. I expect the uptime counter be zero-set at
kernel start time and monotonically tick up for every second the system
runs.
Note: The above reported incorrect behavior was observed on systems
running as amd64 guests under the control of a bhyve supervisor on a
FreeBSD 12.1 host.
--
Ticket URL: <https://dev.haiku-os.org/ticket/18100>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.