Messages in this thread | | | Date | Fri, 17 Sep 2010 15:52:03 +0200 (CEST) | From | Thomas Gleixner <> | Subject | Re: [PATCHv5 0/7] system time changes notification |
| |
On Fri, 17 Sep 2010, Kyle Moffett wrote: > On Fri, Sep 17, 2010 at 08:57, Thomas Gleixner <tglx@linutronix.de> wrote: > > > On Fri, 17 Sep 2010, Alexander Shishkin wrote: > > > Consider we want stuff like "wakeup every day at 3pm", the next wakeup > > > might be earlier than the timer we calculated last time, on system > > > time changes. We need to re-calculate it. This is necessary for all > > > repeating events. > > > > > > Say we want to wakeup at 3pm, now it's 4pm, so we schedule it in 23 > > > hours. Now the system time changes to 2pm, and we would expect to > > > wakeup in one hour, but we take 25. > > > > And that's why we have posix-timers with the ability to arm absolute > > timers. They already deal with the clock being set. > > > > man timer_settime > > > > This still doesn't help with the specified use-case. For example, consider > the case of configuring my crontab to run a command every day at 2PM. > > Let's assume that I then start the cron daemon at 2:05PM, and it establishes > an absolute timer at 2PM the following day. > > I then realize that the clock is wrong, and correct it to read 1:55PM. > > The problem is... cron's timer is still set to trigger at 2PM *tomorrow*, > instead of being readjusted at the time the clock is changed to go off at > 2PM *today*. > > Right now there's really no way to fix that other than polling every so > often to recheck the system time is what you expect.
Hmm, ok.
So what you really want is a timer which drops back to user space with an appropriate error code when something fiddled with the clock.
That's reasonably easy to implement as an extension at least for clock_nanosleep. For the signal based timers it'd be probably quite nasty, but doable.
Thanks,
tglx
| |