Question about update_persistent_clock() routine

Jimmie Mayfield jimmie at sackheads.org
Fri Feb 25 01:05:00 AEDT 2022


Hi,

I'm investigating a timekeeping problem on an old PPC-based embedded 
device and am curious about the update_persistent_clock() routine.   
This device runs a 3.10-era kernel but a similar (deprecated) function 
exists in the 5.16 kernels so I'll refer to the latter:

In arch/powerpc/kernel/time.c :: update_persistent_clock64() we have the 
following:

     rtc_time64_to_tm(now.tv_sec + 1 + timezone_offset, &tm);

I'm particularly curious about why a second is added to the value when 
building 'tm'.  This behavior appears to go back at least to the 2.6-era 
kernels.  Is it simply trying to account for the time spent in the 
kernel prior to updating the RTC?


Jimmie



More information about the Linuxppc-dev mailing list