/etc/default/hwclock
HWCLOCKACCESS=yes
dpkg-reconfigure tzdata
(set to your timezone)
or use /usr/bin/tzselect command
change time with "date" to local time.
OS takes care of the rest, so your hwclock is now set to UTC while date shows local time. TZDATA is updated whenever some countries like Argentina, decide to change the daylight saving time.
this document is not entirely up-to-date:
http://www.debian-administration.org/articles/213
/etc/default/rcS advises:
# assume that the BIOS clock is set to UTC time (recommended)
#UTC=yes # OBSOLETE; see /etc/adjtime and hwclock(8).
my /etc/adjtime right now:
1.868495 1354099078 0.000000
1354099078
UTC
man hwclock
HTH
Kind regards
Eike
--
What is the difference between an optimist and a pessimist?
An optimist thinks that we live in the best of all possible worlds.
A pessimist is afraid that the optimist might be right.
Yep. Unfortunately Microsoft never learned in > 25 years that the world has more time zones than they might have imagined in DOS-times. The drawback comes when you live in an obscure country with daylight savings time other than main cities like Santiago de Chile or Caracas, Venezuela. Bolivia, Paraguay and many of the different timezones of Brazil are entirely ignored.
GMT +X or -X is just not enough.
This does not only affect double boot systems but also syncing PDAs and Smartphones if you are travelling internationally - even WindowsOS to WindowsOS. It is a pain!
So I learned to ignore the time on Windows systems with double boot. That is pure resignation. Windows does not only include crippleware but also is based on cripple-standards. For me UNIX ist the standard because it works and the ret**ds @ MS can eat their own medicine if they like it that way!
If MS had invented the chronometer ships nowadays still would founder because of navigators being utterly unable to calculate the latitude just like in 16th century. I'd recommend: MS please get a rest on the Scilly Islands!
Kind regards
Eike
On Wednesday 28 November 2012 10:09:42 Ralf Mardorf wrote:
> On Wed, 2012-11-28 at 15:55 +0530, J. B wrote:
> > Hello list,
> >
> > My box is configured to the local time zone from beginning, both hwclock
> > and system time. But linux always favor hwclock to UTC. What is the
> > advantage of doing that ?
Your hwclock stays put and daylight saving and latitude is managed by tzdata to show local time. File time-stamps are set to local time, however.
Please correct me if I'm wrong.
ref:
http://www.tldp.org/HOWTO/TimePrecision-HOWTO/set.html
The document distinguishes between a Linux-only-system and a double-boot-system with MS Windows.
In the case of double boot you should set hwclock to local time, as mentioned in the document, or follow the advice by Andrei Popescu and set hwclock to UTC and let WIndows also show UTC. That is useful for radio amateurs who log their activity in UTC anyway.
> >
> > If I need my hwclock to UTC then what should be the right way to do that
> > ? I have followed "dpkg-reconfigure tzdata" and found it has changed the
> > local time to UTC too. Confused .....
Well, J.B. you did something wrong then.
Please show us exactly which steps you did - command by command. Did you set hwclock in the BIOS and then rebooted or did you use "hwclock -u"?
Please show us:
"hwclock -r"
"date"
"date -u"
contents of:
/etc/adjtime
/etc/default/hwclock
/etc/timezone
Then we might be able to find out where the snag lies.
>
> The Linux has to know if the hwclock does use UTC or not and then it
> will set up the clock, when running a Linux to the correct time for your
> timezone. IOW you only have to inform what time hwclock does use.
hwclock --utc
>
> I'm living in Germany, if my hwclock would use UTC time, then saving
> e.g. BIOS settings, would add a wrong time to the files. So I can't see
> an advantage in using UTC. I'm using local time for the hwclock.
Well, Ralf, that wasn't exactly the setting of the OP or was it?
Why do you think that the file creation time is set to UTC and not local time unless your system time is UTC too?
File timestamps are set according to system time - always, or did I miss something?
Here:
hwclock --systohc --utc
username@hostname:~$ touch filetimetest
username@hostname:~$ ls -la |grep timetest
-rw-r--r-- 1 user group 0 Nov 28 11:42 filetimetest
username@hostname:~$ date -u
Wed Nov 28 14:43:01 UTC 2012
username@hostname:~$ date
Wed Nov 28 11:43:03 PYST 2012
Kind regards
Eike
That refers to me, but I didn't say "Idiots", I said "retards" and that is not because of their decision to use hwclock set to localtime but because they do ignore many timezones and do create problems for users in countries which do not appear in their list of timezones. I consider it retarded to ignore the needs of one's customers not only for years, but for decades
But maybe purchasing such goods is even more retarded.
Now back to Unix:.
>
> > That's the smart thing to do
Oops this statement appears now very much out of context but looks cute.
Take this as an example for HOW NOT TO CITE.
> >
> > because it's reliable (independent of time zones and summer/winter
> > time) and every timestamp is fixed. By using local time you are
> > swimming against the current but I don't think the current is all that
> > strong. :-) It just seems to me that doing something that is
> > suboptimal for the sake of a BIOS' settings file's timestamp is a bit
> > silly.
>
> I don't have an disadvantage, I'm using Linux since November 2003,
> there's no Windows on my machine (excepted of XP on VBox). 9 years
> without an issue using local time, but the advantage that the BIOS can
> add the correct timestamp too.
You may do that as you please and if the timestamp on files saved from BIOS is so important to you it is certainly a valid reason to do so.
> So what is the advantage of using UTC? Until now I only see an
> disadvantage using UTC.
The advantage is that because UNIX is designed that way with worldwide networking in mind it is usually (but as you validly pointed out, not always) best to set up the system according to design criteria.
E.g. it becomes sometimes interesting when e-mails are exchanged with mail clients on different OS. Or think of banking transactions or stock exchange transactions.
Mind you that timestamps are not saved as date/time but as Unix time numbers according to the Unix epoch. The Unix time number is then interpreted by the system as date / time according to /etc/localtime.
Even under Unix there are different standards for doing this and of course there are also problems.
see: https://en.wikipedia.org/wiki/Unix_time
If there is a discrepancy between files created by BIOS and those created by the Unix system then it is obvious that the BIOS in question does not use Unix time numbers.
It could have been programmed that way or not. I wonder if there are BIOSes which use the Unix time number? SGI, SUN, experience anybody?
In the 1980s many of our customers (WANG) used local time on the hardware clock. That became an issue as soon as the systems started to be networked / interconnected with IBM SNA and later WANGOFFICE.
The problems which can occur if the hwclock is not set to UTC and the local time calculated according to timezone and the country's daylight saving arrangement is that files created during the shift from daylightsaving to normal time or back you might have diverse files with timestamps close to each other while in reality the files were created more than an hour apart.
This can be the case in the same way if you save files from BIOS during the timeshift, provided your hwclock is set by your system after you rebooted. Using ntp of course.
I admit that this problem might be purely academic as long as you have only one or a few systems to maintain but as soon as the systems are many and diverse as to operating systems, there are headaches preprogrammed.
Been there - done that.
>
> Errare humanum est, sed in errare perseverare diabolicum ;).
>
> If I'm mistaken and there should really be an disadvantage using local
> time, can somebody please explain it? If not, why cherish something that
> has the disadvantage I mentioned? And why always talking about
> Microsoft? This is a Linux list. The BIOS is needed by Linux too.
Because we aproached this from a more general standpoint and the case which you mentioned is a very special case. As I said: both standpoints are valid.
You state a case in which it is not helpful to set hwclock to UTC and we said that *in general* on Unix-like systems it is better to set hwclock to UTC.
Both statements do not exclude each other.
>
> Regards,
> Ralf
Yes, and best regards too
Eike