Re: advice on how to detect time change
- From: Rainer Weikusat <rweikusat@xxxxxxxxxxx>
- Date: Thu, 27 Sep 2007 17:35:24 +0200
John Reiser <jreiser@xxxxxxxxxxxx> writes:
d_cymbal@xxxxxxxxxxx wrote:
Perhaps I didn't phrase that question correctly. My application
doesn't care what the system time is, or care that it is correct, but
it does need to detect if some external entity changes the time out
from under it (this is a master device which must globally update
slave devices with a time change if the user (or some other force such
as ntp) changes the time on the master system. The process itself
doesn't rely on or care what the system time is, it just needs to
detect changes.
There is a design error in your application. It is trying to measure
intervals by subtracting time values.
This is perfectly ok in absence of 'sysadmin interventions' to change
the clock to a new value.
This cannot work reliably ANY system, not just Linux. The time is
the closest known approximation to the value of some counter at your
[government] Standards facility.
This is not correct. The actual definition is
Seconds Since the Epoch
A value that approximates the number of seconds that have elapsed
since the Epoch.
[...]
How any changes to the value of seconds since the Epoch are
made to align to a desired relationship with the current
actual time is implementation-defined.
Further, it is supposed to be counted in UTC. For Linux, more specific
documentation exists, namely time(7):
Real time and process time
Real time is defined as time measured from some fixed
point, either from a standard point in the past
[...]
The Hardware Clock
Most computers have a (battery-powered) hardware clock which
the kernel reads at boot time in order to initialize the
software clock.
[...]
The Software Clock, HZ, and Jiffies
The accuracy of many system calls and timestamps is limited by
the resolution of the software clock, a clock maintained by the
kernel which measures time in jiffies. The size of a
jiffy is determined by the value of the kernel constant HZ.
A related piece of information would be the 'clock correctness
principle' as forumlated in the NTP-documentation: Sucessive readings
of the clock must yield monotonically increasing values.
That is, after all, the purpose of a clock.
.
- References:
- advice on how to detect time change
- From: d_cymbal@xxxxxxxxxxx
- Re: advice on how to detect time change
- From: John Hasler
- Re: advice on how to detect time change
- From: d_cymbal@xxxxxxxxxxx
- Re: advice on how to detect time change
- From: John Reiser
- advice on how to detect time change
- Prev by Date: Re: advice on how to detect time change
- Next by Date: Re: advice on how to detect time change
- Previous by thread: Re: advice on how to detect time change
- Next by thread: Re: advice on how to detect time change
- Index(es):
Relevant Pages
|