Re: advice on how to detect time change
- From: Andrei Voropaev <avorop@xxxxxxx>
- Date: Fri, 28 Sep 2007 07:11:42 +0000 (UTC)
On 2007-09-28, Dildo Bogumil di Boscopelo <psycho_78@xxxxxxxxx> wrote:
d_cymbal@xxxxxxxxxxx wrote:
I have a requirement to detect whether the system time changes out
from under my running application via some external force (ntp update,
admin change, etc.) All I've been able to come up with so far are
Easy! poll time every 0.5 seconds, then store it. Check if there's more than
1" difference with the last value stored. :-)
One may try to use setitimer to trace time intervals internally and then
compare it with the system clock intervals. But there's a catch.
setitimer is not very accurate. Even using getitimer to check the
elapsed time does not provide you high accuracy. For that you'll have to
understand how the jiffies to seconds conversion is done in kernel (and
in different kernel versions it's done differently). Plus you have to
take into account the scheduling delays for your program. But it's worth
giving it a try :)
--
Minds, like parachutes, function best when open
.
- References:
- advice on how to detect time change
- From: d_cymbal@xxxxxxxxxxx
- Re: advice on how to detect time change
- From: Dildo Bogumil di Boscopelo
- advice on how to detect time change
- Prev by Date: Re: advice on how to detect time change
- Next by Date: Re: Regarding shared library and GDB
- Previous by thread: Re: advice on how to detect time change
- Next by thread: Regarding shared library and GDB
- Index(es):