View previous topic :: View next topic |
Author |
Message |
Salemixu n00b
Joined: 01 Jul 2004 Posts: 72 Location: Spain
|
Posted: Fri Apr 27, 2007 2:57 pm Post subject: How to set correct timezone (CET) in Embedded Gentoo |
|
|
Hi!
I'm using Embedded Gentoo on some machines that must be synchronized in time.
So I thought on installing NTP to maintain the same time in each machine using the same NTP servers.
One of the main problems i've got after trying tons of things to get the same time in all the machines is the timezone.
I'm in Barcelona (Spain), so the timezone is GMT+1 and GMT+2 for Daylight Saving Time, also I can use CET or Europe/Madrid for this purpose. I'd prefer using CET or Europe/Madrid because when the time changes in DST i shouldn't care of it, and the machine (or NTP) itself changes the time.
The main problem is that it seems that in Embedded Gentoo the timezones are not the same as on the usual Gentoo distro, so if i set /etc/TZ to CET or to Europe/Madrid it doesn't recognizes it and uses the default (that is UTC).
Also setting in bash the variable TZ to any of the options doesn't work.
What works is setting TZ to GMT-2, and then i can see the correct time and date. The strange thing is that it should be GMT+2, but GMT+2 puts the clock to 4 hours before the actual time.
I tried to copy /usr/share/zoneinfo/Europe/Madrid to /etc/localtime and it seems it doesn't take it into account when setting the system clock.
I also read the init scripts of Gentoo searching for something using /etc/localtime setting the timezone and didn't find anything.
Is there a way to set the timezone to CET or using /etc/localtime in Embedded Gentoo? I wouldn't like to use GMT-2 since maybe the date isn't changed according to DST.
I'm not using the usual init scripts of gentoo (i'm using baselayout-lite) so i have made some scripts controlling different applications that must be installed in these computers.
Here is an small part of my modified inittab regarding ntp stuff:
Code: |
::sysinit:/usr/sbin/ntpdate -s -b hora.rediris.es ns.dns.pt ntp.unice.fr
::sysinit:/usr/sbin/ntpd -g
... blah blah ...
::shutdown:/sbin/hwclock --systohc -u
::shutdown:/bin/killall -9 ntpd
|
And the relevant part of my ntp.conf :
Code: |
driftfile /var/lib/ntp/ntp.drift
server hora.rediris.es prefer
server ns.dns.pt
server ntp.unice.fr
restrict default nomodify nopeer
restrict 127.0.0.1
|
Thanks in advance |
|
Back to top |
|
|
Edel n00b
Joined: 12 Jan 2003 Posts: 19 Location: Philippines (Naga City)
|
Posted: Sat Apr 28, 2007 4:53 am Post subject: |
|
|
regarding /etc/TZ, mine looks like:
Code: | router# cat /etc/TZ
PHT-8 |
im in philippines w/ timezone GMT+8 (hence, advanced by -8 in /etc/TZ file).
hth.
--edel _________________ Bicolano ini... maurag! |
|
Back to top |
|
|
Salemixu n00b
Joined: 01 Jul 2004 Posts: 72 Location: Spain
|
Posted: Mon Apr 30, 2007 8:21 am Post subject: |
|
|
Thanks Edel
I'm on GMT+1, and is it's spring/summer it's GMT+2, so at this momment setting TZ to GMT-2 works perfectly.
The problem is when Daylight Saving Time won't be present (the time will change to GMT+1) it would not update the date and time with the one hour change (I think it happens like that, if I'm wrong, please correcte me). So I supposed that if I set the timezone to CET (the current time where I am) or to Europe/Madrid the date/time change would be automatic when the DST thingy changes. |
|
Back to top |
|
|
|