On Tue, 14 Nov 2006 14:30:57 -0500, Boris Benenson
<boris.benen
...@marconi.com> wrote:
> Is there a way in either standard or Real-time Linux to get "absolute
> number of ticks (or seconds) since the Epoc (or some other
> configurable starting point), regardless of the kernel clock resets
> via settimeofday() and the RTC resets via hwclock set and regardless
> of the system reboots?
clock_gettime (CLOCK_MONOTONIC, tp):
That will get a guaranteed-monotonic time regardless of settimeofday()
and friends. In Linux it is the time since the last boot, but POSIX
doesn't guarantee that, just that it is monotonically increasing. But
if what you want is a clock to use to trigger an event X seconds from
now, that's the one you want.
I don't know of a way to get the absolute time that will work across a
reboot or reset of the RTC. That last seems like kind of a tall order
since it is the only thing in the system that keeps time when the power
is off.
NTP might do some of what you want, but if the goal is to have the time
be correct even if root tries to mess it up, then NTP won't help.
--
-| Bob Hauck
-| Have you had enough of George Bush yet?
-| http://www.haucks.org/