CVSROOT:        /cvs
Module name:    src
Changes by:     chel...@cvs.openbsd.org 2020/05/20 11:21:08

Modified files:
        share/man/man9 : microtime.9 
        sys/kern       : kern_tc.c 
        sys/sys        : time.h 

Log message:
timecounting: decide whether to advance offset within tc_windup()

When we resume from a suspend we use the time from the RTC to advance
the system offset.  This changes the UTC to match what the RTC has given
us while increasing the system uptime to account for the time we were
suspended.

Currently we decide whether to change to the RTC time in tc_setclock()
by comparing the new offset with the th_offset member.  This is wrong.
th_offset is the *minimum* possible value for the offset, not the "real
offset".  We need to perform the comparison within tc_windup() after
updating th_offset, otherwise we might rewind said offset.

Because we're now doing the comparison within tc_windup() we ought to
move naptime into the timehands.  This means we now need a way to safely
read the naptime to compute the value of CLOCK_UPTIME for userspace.
Enter nanoruntime(9); it increases monotonically from boot but does not
jump forward after a resume like nanouptime(9).

Reply via email to