linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Richmond <bob@lorez.org>
To: linux-kernel@vger.kernel.org
Subject: Real time clock update notification
Date: Fri, 27 Jan 2012 14:52:20 -0800	[thread overview]
Message-ID: <4F232AA4.5070208@lorez.org> (raw)

Is there any kind of facility for a process that is blocking in any one 
of the event notification system calls (select/poll/epoll_wait) to be 
unblocked in the event that the realtime clock has been updated? For 
instance, say I want to fire off an event at the exact moment that the 
realtime clock flips to 2pm. I first query the realtime clock via 
clock_gettime(CLOCK_REALTIME), and know that in 3 hours, it will be 2pm 
and I want to unblock at that moment. So I block in epoll_wait for 3 hours.

Then ntpd decides that the rtc is way off, and updates the current time 
to 1:30, and I should now be unblocking 30 minutes from now. However, my 
process can't know that this occurred and I should requery the rtc to 
find out how long I need to sleep *now*. It looks like crond (which 
performs a similar task) just wakes itself up every 60 seconds, which 
isn't particularly ideal.

If this facility doesn't exist, I'm curious whether something like it 
would be feasible to introduce with minimal overhead. I'm unsure how 
often ntpd resets the rtc when clock skew is detected, and my process 
might be excessively notified whenever the time changes by a few 
milliseconds.

             reply	other threads:[~2012-01-27 23:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 22:52 Bob Richmond [this message]
2012-01-28 14:26 ` Real time clock update notification Colin Walters

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F232AA4.5070208@lorez.org \
    --to=bob@lorez.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).