View previous topic :: View next topic |
Author |
Message |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Thu Jul 28, 2005 11:20 am Post subject: hwclock --utc == local time, --localtime == UTC time? |
|
|
Guys i'm a bit confused with results of querying hwclock.
My local time is GMT + 4, so first i set my system time using "date". Then i set hwclock using "hwclock --systohc --utc" command in order to have my RTC in UTC. However querying hwclock reveals a bit confusing results:
Code: |
# hwclock --utc
Thu Jul 28 15:14:13 2005 -0.530722 seconds
|
Code: |
# hwclock --localtime
Thu Jul 28 11:14:40 2005 -0.476347 seconds
|
It seems it prints local time with --utc switch and its actual internal time with --localtime switch, right? If yes, why not vice versa? It would be more logical IMHO...
Last edited by pachanga on Fri Jul 29, 2005 8:19 am; edited 2 times in total |
|
Back to top |
|
 |
RiBBiT Apprentice


Joined: 18 May 2005 Posts: 215 Location: Sweden
|
Posted: Thu Jul 28, 2005 11:25 am Post subject: |
|
|
For me it's the other way around. _________________ Comix - GTK Comic Book Viewer [ http://comix.sourceforge.net ] |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Thu Jul 28, 2005 11:27 am Post subject: |
|
|
RiBBiT wrote: | For me it's the other way around. |
Do you mean running hwclock --utc returns UTC time? |
|
Back to top |
|
 |
RiBBiT Apprentice


Joined: 18 May 2005 Posts: 215 Location: Sweden
|
Posted: Fri Jul 29, 2005 12:32 am Post subject: |
|
|
That's exactly what I meant. However I just discovered I was wrong, my hardware clock had been f*cked up by my Windows installation so it was set to local time. hwclock --utc indeed seems to display the local time while hwclock --localtime displays UTC, weird. _________________ Comix - GTK Comic Book Viewer [ http://comix.sourceforge.net ] |
|
Back to top |
|
 |
irasnyd Apprentice


Joined: 16 Feb 2003 Posts: 286 Location: Placentia, CA
|
Posted: Fri Jul 29, 2005 5:53 am Post subject: |
|
|
Same thing is happening here. I haven't had windows on this machine in almost a year.
Code: |
yuki ~ # date
Thu Jul 28 22:47:01 PDT 2005
yuki ~ # hwclock --utc
Thu Jul 28 22:47:08 2005 -0.287794 seconds
yuki ~ # hwclock --localtime
Fri Jul 29 05:47:14 2005 -0.328052 seconds
yuki ~ # ls -l /etc/localtime
lrwxrwxrwx 1 root root 39 Feb 18 16:51 /etc/localtime -> /usr/share/zoneinfo/America/Los_Angeles
yuki ~ # hwclock -w --utc
yuki ~ # hwclock --utc
Thu Jul 28 22:48:18 2005 -0.997177 seconds
yuki ~ # hwclock --localtime
Fri Jul 29 05:48:22 2005 -0.397110 seconds
|
And here is my /etc/conf.d/clock file:
Code: |
# /etc/conf.d/clock
# Set CLOCK to "UTC" if your system clock is set to UTC (also known as
# Greenwich Mean Time). If your clock is set to the local time, then
# set CLOCK to "local".
CLOCK="UTC"
# If you wish to pass any other arguments to hwclock during bootup,
# you may do so here.
CLOCK_OPTS=""
# If you want to set the Hardware Clock to the current System Time
# during shutdown, then say "yes" here.
CLOCK_SYSTOHC="yes"
### ALPHA SPECIFIC OPTIONS ###
# If your alpha uses the SRM console, set this to "yes".
SRM="no"
# If your alpha uses the ARC console, set this to "yes".
ARC="no"
|
How did you get it fixed? I can't seem to get my clock set to UTC. I thought it was for all this time. "date" has been working fine, although I have been seeing some weird times in my logs. Maybe this is related.
Thanks. |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Fri Jul 29, 2005 8:16 am Post subject: |
|
|
irasnyd wrote: |
How did you get it fixed? I can't seem to get my clock set to UTC.
|
If you're talking about RTC, try
Code: |
hwclock --systohc --utc
|
This should set your hardware clock equal to system clock and mark it as UTC time. |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Fri Jul 29, 2005 8:18 am Post subject: |
|
|
RiBBiT wrote: | hwclock --utc indeed seems to display the local time while hwclock --localtime displays UTC, weird. |
Maybe that's ok? Well i can live with that but they should point this issue more explicitly in man then IMHO... |
|
Back to top |
|
 |
Kaapeli Tux's lil' helper

Joined: 27 Dec 2004 Posts: 110 Location: Oulu, Finland
|
Posted: Fri Jul 29, 2005 2:50 pm Post subject: |
|
|
pachanga wrote: | irasnyd wrote: |
How did you get it fixed? I can't seem to get my clock set to UTC.
|
If you're talking about RTC, try
Code: |
hwclock --systohc --utc
|
This should set your hardware clock equal to system clock and mark it as UTC time. |
Doesn't this do it automatically correctly:
Code: |
/etc/init.d/clock save
|
_________________ Temperatures |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Fri Jul 29, 2005 3:08 pm Post subject: |
|
|
Well, anyway the question remains - is this behaviour of hwclock ok??? |
|
Back to top |
|
 |
RiBBiT Apprentice


Joined: 18 May 2005 Posts: 215 Location: Sweden
|
Posted: Sat Jul 30, 2005 11:08 am Post subject: |
|
|
I think I discovered why it seems wrong. hwclock ALWAYS displays the local time. --utc tells hwclock it is set by UTC and the timezone modifier is applied to the time before it is displayed. If --localtime is used hwclock thinks it is already synced with local time and the timezone modifier is not applied. _________________ Comix - GTK Comic Book Viewer [ http://comix.sourceforge.net ] |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Sat Jul 30, 2005 11:21 am Post subject: |
|
|
RiBBiT wrote: | I think I discovered why it seems wrong. hwclock ALWAYS displays the local time. --utc tells hwclock it is set by UTC and the timezone modifier is applied to the time before it is displayed. If --localtime is used hwclock thinks it is already synced with local time and the timezone modifier is not applied. |
Still pretty weird, isn't it? |
|
Back to top |
|
 |
RiBBiT Apprentice


Joined: 18 May 2005 Posts: 215 Location: Sweden
|
Posted: Sat Jul 30, 2005 11:50 am Post subject: |
|
|
pachanga wrote: | RiBBiT wrote: | I think I discovered why it seems wrong. hwclock ALWAYS displays the local time. --utc tells hwclock it is set by UTC and the timezone modifier is applied to the time before it is displayed. If --localtime is used hwclock thinks it is already synced with local time and the timezone modifier is not applied. |
Still pretty weird, isn't it? |
Not very weird when you think about it. hwclock have no means to know if it set by UTC or local time by it self, so asking it to display the time of the current system (which is always local time) makes no sense if you don't tell it what timezone it is set by in the first place. _________________ Comix - GTK Comic Book Viewer [ http://comix.sourceforge.net ] |
|
Back to top |
|
 |
CarlosAB n00b


Joined: 04 Apr 2005 Posts: 8 Location: Brazil-RS
|
Posted: Sat Aug 06, 2005 2:56 pm Post subject: Dazed & confused |
|
|
So, how can someone like me can setup his RTC and system clock, with "/etc/init.d/clock" and his step brother "/etc/conf.d/clock", to work togheter as a team.
Thanks
Carlos[/code] |
|
Back to top |
|
 |
firekopf n00b

Joined: 30 Nov 2004 Posts: 31
|
Posted: Sat Aug 06, 2005 4:48 pm Post subject: |
|
|
okay, I'm having a similar problem with my hwclock. Whenever I type hwclock it says it 'timed out waiting for time change' so the hwclock is not set, meaning it defaults to January 1, 1970 for some reason. I can change the software clock with date but I don't want to have to do that every boot.
Anyone have a solution? |
|
Back to top |
|
 |
RiBBiT Apprentice


Joined: 18 May 2005 Posts: 215 Location: Sweden
|
Posted: Sat Aug 06, 2005 5:19 pm Post subject: |
|
|
firekopf wrote: | okay, I'm having a similar problem with my hwclock. Whenever I type hwclock it says it 'timed out waiting for time change' so the hwclock is not set, meaning it defaults to January 1, 1970 for some reason. I can change the software clock with date but I don't want to have to do that every boot.
Anyone have a solution? |
Could it be your BIOS battery that's running low? The reason your hardware clock is set to January 1, 1970 is because that is the base of most computer clocks. The current time is expressed as a number of seconds from January 1, 1970. 19:15:34 today, for an example, is 1123348534 seconds from January 1, 1970. If you don't want to change the clock manually every boot you can use some NTP application (emerge ntp). _________________ Comix - GTK Comic Book Viewer [ http://comix.sourceforge.net ] |
|
Back to top |
|
 |
firekopf n00b

Joined: 30 Nov 2004 Posts: 31
|
Posted: Sat Aug 06, 2005 7:15 pm Post subject: |
|
|
I'm not sure the actual physical hardware clock is the problem. Wouldn't it still be able to detect a tick when it had main power? The clock on my Mac OS partition functions fine, which I don't think it would if the actual clock ran out of juice. |
|
Back to top |
|
 |
RiBBiT Apprentice


Joined: 18 May 2005 Posts: 215 Location: Sweden
|
Posted: Sat Aug 06, 2005 7:38 pm Post subject: |
|
|
Do you have clock set up to start at boot (rc-update show)? Can you post your /etc/conf.d/clock? _________________ Comix - GTK Comic Book Viewer [ http://comix.sourceforge.net ] |
|
Back to top |
|
 |
firekopf n00b

Joined: 30 Nov 2004 Posts: 31
|
Posted: Mon Aug 08, 2005 3:32 pm Post subject: |
|
|
just out of curiosity, its probably a bad sign that I don't have /etc/conf.d/clock? |
|
Back to top |
|
 |
theWebster n00b

Joined: 26 Nov 2003 Posts: 4 Location: 15 min south of KU
|
Posted: Sat Aug 27, 2005 5:10 am Post subject: |
|
|
arrgh!! I think I finally got this working, but I'm confused by the redundancies I see and have yet
to check what happens if I try setting the time in KDE (not that I should *ever* have to do so again...!!!)
Anyhow, my hwclock, date and localtime all reported UTC time. I checked that /etc/timezone was set OK,
but had failed to notice that somewhere along the way the /etc/localtime had VANISHED. So, after
Code: | ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime | it is looking fixed.
I'm using
Code: | # /etc/conf.d/ntp-client
NTPCLIENT_CMD="ntpdate"
NTPCLIENT_OPTS=" -b -u 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org"
NTPCLIENT_TIMEOUT=30
|
Code: | # /etc/conf.d/clock
CLOCK="local"
CLOCK_OPTS=""
CLOCK_SYSTOHC="no"
SRM="no"
ARC="no"
|
Code: | # /etc/conf.d/ntpd
NTPD_OPTS="-u ntp:ntp"
|
HTH, it has been about the most irritating item so far, but I've been away for several years as the weeks
it took to get as far as a CLI was too frustrating. I have however, in two days, got through wiping all I had
before and installing fresh from Stage 3 tarball and minimal CD, to an incredibly awesome dazzling KDE
complete with a dozen or two goodies beyond the default base, including koffice, samba and support for
my nForce ethernet (that last being #2 irritation...) I am feeling about the same as when I first succeeded
in creating a PPP connection and fired up the then-brand-new Netscape. I believe gentoo will save mankind, I do. _________________ michael |
|
Back to top |
|
 |
|