From owner-freebsd-current Thu May 17 18:40:21 2001 Delivered-To: freebsd-current@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 77BE237B424 for ; Thu, 17 May 2001 18:40:18 -0700 (PDT) (envelope-from jdp@wall.polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.11.3/8.11.1) with ESMTP id f4I1eD015706; Thu, 17 May 2001 18:40:13 -0700 (PDT) (envelope-from jdp@wall.polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.11.3/8.11.0) id f4I1eBZ92306; Thu, 17 May 2001 18:40:11 -0700 (PDT) (envelope-from jdp) Date: Thu, 17 May 2001 18:40:11 -0700 (PDT) Message-Id: <200105180140.f4I1eBZ92306@vashon.polstra.com> To: current@freebsd.org From: John Polstra Cc: huntting@glarp.com Subject: Re: catching abrupt time changes In-Reply-To: <200105170722.f4H7MmR27336@hunkular.glarp.com> References: <200105170722.f4H7MmR27336@hunkular.glarp.com> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: X-Loop: FreeBSD.ORG In article <200105170722.f4H7MmR27336@hunkular.glarp.com>, Brad Huntting wrote: > > 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? This may be more work than you want to do, but ... You could add a new kqueue event which is generated when the system time is stepped. Then you could do your sleeping with kevent(). John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message