You are not logged in.
Pages: 1
I'm facing a strange problem with UTC time, maybe I don't understand what is the meaning of UTC time but anyway I can't fix this on my own. My locale configuration is:
LOCALE="it_IT.utf8"
DAEMON_LOCALE="no"
HARDWARECLOCK="UTC"
TIMEZONE="Europe/Rome"
and my hardware clock says:
$ hwclock
sab 07 gen 2012 17:23:03 CET -0.609866 secondi
Since I live in the GMT+1 time zone (Europe/Rome) I was expecting that system clock would be set to 18:23:03, instead at boot it always has the same time as hwclock, until ntp fix things after a while. But at successive reboots, the history repeats. This is my daemons line:
DAEMONS=(syslog-ng @cpufreq network netfs crond dbus @cupsd @ntpd)
What's wrong in my configuration? Or maybe it works as expected and I didn't understand the expected behavior?
Thanks.
Last edited by snack (2012-02-05 11:18:27)
Offline
Offline
Thanks, I really don't understand much about that discussion but I hope devs can fix this.
Offline
I really can't understand this:
$ hwclock --localtime
dom 08 gen 2012 10:56:17 CET -0.442359 secondi
$ hwclock --utc
dom 08 gen 2012 11:56:21 CET -0.676715 secondi
Given my timezone (Europe/Rome) I would expect utc=11:56 localtime=12:56...
Offline
I can't say anything to help you but I'm glad that I'm not the only one with this bug;
[andreas@myhost ~]$ hwclock --localtime
So 08 Jan 2012 13:16:22 CET -0.875533 Sekunden
[andreas@myhost ~]$ hwclock --utc
So 08 Jan 2012 14:16:31 CET -0.844310 Sekunden
I was beginning to think this might have something to do with my firewall not letting sync ntp but that's fortunately not the case...
As always we need to wait until it's fixed...which pretty much describes my whole Linux experience for nearly 4 years now...you alway wait for something to finally work wheather it's an xorg issue, a graphic driver thing, etc, etc, etc...
Greets
Andreas
Last edited by Kodama (2012-01-08 12:21:30)
Offline
I'm not sure it is a bug, rather I think that there's something I don't understand in how Linux handles rtc, utc, system clock and all that... I hope someone with greater knowledge than me would clarify some of these points.
Offline
I had the same issue but I fixed it by setting up the ntpd daemon correctly using the server informaton from http://www.ntp.org/, syncing ntpd -q and then using hwclock --systohc.
I'm on UTC and Europe/Amsterdam, no problems.
Last edited by alexkarro (2012-01-08 17:19:46)
Offline
I solved my clock problems by running hwclock "manually" in rc.local. I think I already explained it in another post, but anyway...
1) set your clock correctly, then run "hwclock --systohc --utc"
2) add "hwclock --hctosys" in /etc/rc.local
3) (if running openntpd which does not update the hwclock) add "hwclock --systohc" in /etc/rc.shutdown.local
4) make sure you have the ntpd (or openntpd) daemon in /etc/rc.conf (in fact I'm also running openntpd from rc.local so that it is run right after network is available). Also make sure you're _not_ running the hwclock daemon.
If for some reason you want to switch to localtime you just have to replace "--utc" with "--localtime" in step 1) (at least with openntpd). Whether your hw clock was stored in UTC or in localtime is stored in /var/lib/hwclock/adjtime.
Edit: several edits, please re-read everything .
Edit 2: I see that /etc/rc.sysinit actually sets the clock with "--systz" ("set the system time based on the current timezone") and uses the HARDWARECLOCK variable...
This is an alternate option to --hctosys that does not read the
hardware clock, and may be used in system startup scripts for
recent 2.6 kernels where you know the System Time contains the
Hardware Clock time.
Not sure what's the point.
Last edited by stqn (2012-01-09 14:53:18)
Offline
Thaks everybody for the answers. Apart from making my system work, I'd like to understand what is the meaning of having hwclock set to utc or localtime. Being not an expert at all, I naively thoght that HARDWARECLOCK="UTC" means: set the hwclock to GMT, no matter where in the world you are; then, according to your timezone (set in rc.conf, for me it is Europe/Rome), system clock will be set accordingly on boot by the kernel (for me, it would be sysclock=hwclock+1hour); ntpd may eventually make fine adjustments to sysclock if it is running, then on shutdown it will sync hwclock (for me, hwclock=sysclock-1). Conversely, "LOCALTIME" would mean hwclock=sysclock.
Something must be wrong in all this reasoning because setting HARDWARECLOCK="UTC" and hwclock to GMT makes my sysclok=hwclock=GMT, until ntpd corrects it to sysclok=hwclock+1hour (after some minutes after boot).
Offline
I think I found the solution: hwclock takes into account the locale when setting and reading the hardware clock. This means that one should set the hwclock to UTC not using the GMT but rather the local time. hwclock will automatically convert the localtime to UTC and set it. So if I live in GMT+1 time zone and my local time is 10:00, I should set hwclock to 10:00, and I guess the hardware clock will be effectively set to 9:00. Similarly, when reading the hardware clock the displayed time is converted to local time (you can verify it by changing the TZ environment variable to other time zones and see that the time displayed by hwclock changes accordingly, without setting the hardware clock).
Marking as solved, thanks everybody for the help.
Offline
Pages: 1