> however a simple script like the following shows you that hwclock
> always gives you forward values
Hi there,
a few random thoughts...
If you're on Linux, you can "strace" your Bash shell script
and a simple Java program calling System.currentTimeMillis()
and/or System.nanoTime().
You'll see that hwclock is querying the "Real-Time Clock"
(open /dev/rtc), which I think is mandated by hwclock's specs.
Both System.currentTimeMillis() and System.nanoTime() call
Linux's gettimeofday(...), the implementation of which depends
on the hardware available, the options chosen when compiling
the kernel, etc. That implementation could very well use the
newer HPET "timer" (the 'T' stands for timer, so I'm being
redundant ;) or it could use the TSC, or the PIT, etc. The TSC
is known to be broken on some architectures (synch problems,
problems with CPUs 'throttling' their speed, etc.).
It used to be that the timesource for gettimeofday() could be set
in real-time on Linux, which may be fun for you to experiment with
(but I don't know if this is still the case).