Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have strange problem with the system clock in my Linux system, TinyCore, kernel 2.6.38 .
dmesg says the following:

rtc_cmos 00:04: setting system clock to 2012-08-08 19:20:00 UTC (since_epoch-value)

but actually, when i test date, it always starts as 1/1/2001 01:43:00, while hwclock shows the correct time.
now if i run hwclock -s, it's fixed until the next boot.
this system is like a "live CD" that's loaded to RAM and umount the storage device.
my guess is that the kernel indeed set the time from rtc0, but maybe a file overwriting resets the system clock. could it be (included /dev/something)?

share|improve this question
    
I've answered with a solution, but exactly do you mean with: "system is like a live CD" ? – Zuul Aug 8 '12 at 18:22
    
i mean there is no non-volatile storage in that system. so in every boot, the same filesystem is loaded. – RoeeK Aug 9 '12 at 6:53

Background

In Linux, the system time zone is determined by the symbolic link /etc/localtime.

This mentioned link points to a time zone data file that describes the local time zone. The time zone data files are located at either /usr/lib/zoneinfo or /usr/share/zoneinfo depending on what distribution of Linux you use.

hwclock

hwclock is a tool for accessing the Hardware Clock. You can display the current time, set the Hardware Clock to a specified time, set the Hardware Clock to the System Time, and set the System Time from the Hardware Clock.

The Hardware Clock: This is a clock that runs independently of any control program running in the CPU and even when the machine is powered off.

If you use -s it will set the System Time from the Hardware Clock. That why you get the problem fixed.

Solution

You can execute a command in your terminal to set the symbolic link, it will persist even after reboot:

sudo ln -sf /usr/share/zoneinfo/Portugal /etc/localtime

For me its Portugal, adapt the command to your time zone.

share|improve this answer
    
the distribution is TinyCore, and i don't have /usr/lib/zoneinfo nor /usr/share/zoneinfo nor /etc/localtime. can it cause this problem that the time is not updated from boot, but updated correctly when i hwclock -s manually? – RoeeK Aug 9 '12 at 6:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .