Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2001 18:40:11 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        current@freebsd.org
Cc:        huntting@glarp.com
Subject:   Re: catching abrupt time changes
Message-ID:  <200105180140.f4I1eBZ92306@vashon.polstra.com>
In-Reply-To: <200105170722.f4H7MmR27336@hunkular.glarp.com>
References:  <200105170722.f4H7MmR27336@hunkular.glarp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <200105170722.f4H7MmR27336@hunkular.glarp.com>,
Brad Huntting  <huntting@glarp.com> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105180140.f4I1eBZ92306>