>  I am using this (yes, visually cr@ppy ;-)) code snippet to set back
> the time 5 hours. hwclock tells me it worked fine but the terminal
> windows opened before and after running hwclock still give me the
> "old" time setting?

The hardware clock is an "external" device which the Linux kernel
typically uses in very limited ways:
1- it reads it at boot to figure out what is the current time to
   initialize the system's own time.
2- it adjusts it every once in a while when the system's time is
   presumed to be more precise (because it's using NTP).

If you want to change the system's time, then change the system's time,
not the hardware clock.

To change the system's time, use `date` (see `man date` for the format
of its arguments).

But changing the system's time is very rarely a good idea.

If you want to change the time based on timezone issues, then change the
*timezone* rather than the time this way your running applications won't
be subjected to time travel, which tends to cause all kinds of odd
behaviors because suddenly the timer that was supposed to fire after
a handful of seconds suddenly waits 5h, or the timeout that should only
fire when there's really no answer after 2min fires right away because
it thinks 5h have passed.  Oh, and connections on the internet may fail
when your machine's time is to too far out of sync (and 5h *is* far),
since some authentication algorithms rely on time constraints.

Note that the timezone is not a system-wide setting.  Every process can
use its own timezone, e.g. by setting the `TZ` environment variable.
Try for example `TZ=UTC date` and then `TZ=Pacific/Samoa date`.
Browse /usr/share/zoneinfo/ to see the list of timezones your system
knows about.


        Stefan

Reply via email to