Date: Thu, 17 May 2001 01:22:48 -0600 From: Brad Huntting <huntting@glarp.com> To: current@FreeBSD.ORG Subject: catching abrupt time changes Message-ID: <200105170722.f4H7MmR27336@hunkular.glarp.com>
next in thread | raw e-mail | index | archive | help
Suppose I'm a (root) process: I have an appointment in exactly one hour. I call select() and specify a timeout of 3600 seconds, trusting that the system will wake me up just in time. But unbeknownst to me someone sets the clock back 10 minutes while I'm asleep (using settimeofday(), not adjtime()). When select() returns I find that I'm 10 minutes late! My question is: How can I arrange to be notified when someone and makes a corse change to the system clock? One idea I had was to generate a klog message for each call to settimeofday(). This would put the information in syslog, and I could simply add /dev/klog to the list of file descriptors in it's select() call (there will be lots of false alarms, but that's probably not a problem for this application). Another idea was to add a new minor device to klog that just logs calls to settimeofday(). Could this be generalized? Alternately such a device file could be put in /proc (smells like a Linux solution). Or perhaps I could select() for "read" or "err" conditions on /kern/time (from kernfs). Any thoughts? brad P.S. The application in question is a new schedular for cron/at that can sleep between jobs. This would seem to be a good first step toward better laptop power management. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105170722.f4H7MmR27336>