Re: [PATCHv5 0/7] system time changes notification

From: Thomas Gleixner
Date: Fri Sep 17 2010 - 08:58:33 EST


On Fri, 17 Sep 2010, Alexander Shishkin wrote:

> Hi,
>
> This is the fifth version of system time change notification mechanism
> for linux kernel. The need for it comes from applications which would
> like to keep track of time changes without having to wake up every
> $TIMEOUT and calling gettimeofday().
>
> An excellent description for one of the usecases, written by Kay Sievers
> (http://kerneltrap.org/mailarchive/linux-kernel/2010/8/5/4603531):
> """
> This is the example Lennart and I thought about when we considered
> adding cron-like stuff to systemd's timer configs, but didn't want to
> do silly things like scheduled checks for the actual time, so we
> delayed this feature until such a notification becomes available.
>
> 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

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/