Kicker said:
This is not what one would expect: my laptop crashes all the time, but it doesn't lose anything close to hours from its clock. And certainly consoles with time&date functions have been around since at least the Dreamcast, and it always knew what date it was, unless it stayed unplugged for a really long time.
Linux maintains its system time internally (from the system timer interrupt), and the RTC ticks its own time. Let me demonstrate:
Code:
[root@phenom MythBusters]# hwclock --show
Wed 09 Jun 2010 01:37:21 AM EEST -0.358549 seconds
[root@phenom MythBusters]# date
Wed Jun 9 01:37:21 EEST 2010
Above is time in my RTC, the second is time in Linuxs system clock (the one used generally)
... When I do this:
Code:
[root@phenom MythBusters]# date -s 02:00
Wed Jun 9 02:00:00 EEST 2010
[root@phenom MythBusters]# date
Wed Jun 9 02:00:02 EEST 2010
[root@phenom MythBusters]# hwclock --show
Wed 09 Jun 2010 01:41:13 AM EEST -0.415251 seconds
The system clock changes time, but the hardware RTC is still running its own time. This is the situation on the pandora if it has just been booted with the wrong time, and the time has been set, but only the system clock is set.
Upon reset, this happens (done by the kernel, but get the idea):
Code:
[root@phenom MythBusters]# hwclock --hctosys
[root@phenom MythBusters]# date
Wed Jun 9 01:42:52 EEST 2010
And BTW, if you want to make sure (on an x86 box atleast, Im not 100% sure about pandora) that your current system clock is written to your RTC, you can do:
Code:
[root@phenom MythBusters]# hwclock --systohc
If your hardware clock is in UTC, add --utc to the hwclock invocations (dont know about the default in the pandora).
And yeah i was watching mythbusters with mplayer just before this
EDIT: To clarify, any decent linux distro should do hwclock --systohc (with --localtime or --utc depending on configuration) upon shutdown, so users shouldnt normally need to worry about all this stuff.