lkml.org 
[lkml]   [2021]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectTime keeping while suspended in the presence of persistent clock drift
Hi,
I have an x86 laptop whose CMOS (RTC) clock gains an extra 3.75 seconds
per day that it is suspended (S3) or off. It keeps time quite accurately
while awake using the TSC clock source. I use the machine about 1 hour
per day with the machine in the S3 sleep state for the remaining 23
hours. The machine is not usually connected to a network and I do not
run an NTP daemon (though I do not believe this is relevant). When cold
booting, I correct for the CMOS clock drift using hwclock before making
the filesystem writable. When resuming from suspend-to-ram (S3),
however, I must either use hwclock again (causing the system time to
jump backwards and potentially upsetting programs like make) or use a
large slew rate (absolute value greater than 1000 PPM) to correct the
system clock. As far as I can tell there is currently no way to inform
the kernel of my CMOS clock drift. Is this correct? I am considering
writing a patch to make the kernel compensate for the drift of the
persistent and/or RTC clock(s) when injecting sleep time. The patch
would require user space to inform the kernel of the drift (probably via
sysfs). Does this seem like a good approach? Regards, Joel Daniels


\
 
 \ /
  Last update: 2021-12-09 18:57    [W:0.085 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site