PDA

View Full Version : Getting the timezone correct



el_supremo
08-18-2004, 03:17 AM
Up to now I've been ignoring the fact that when I boot Knoppix 3.4 (2004/.5.17) the local timezone is assumed to be EDT America/NewYork. But I'm trying to get a satellite prediction program working and my timezone has to be correct.
I have determined that my hardware clock is set to local time.
When I boot with the cheatcode:

tz=America/Regina
it makes no difference to the displayed timezone. It's still EDT but should be CST and the /etc/localtime file is also EDT.
I've put some debugging in knoppix.sh and the TZ variable is being set to the correct zone from the tz= cheatcode but it makes no difference.

If I do the following as superuser:


TZ=America/Regina
export TZ
hwclock -s

the monitor goes weird until I hit a key but then the timezone has been set correctly.

Why doesn't specifying the correct tz= cheatcode set the correct time at boot up and how do I fix it?

Best Wishes
Pete

CrashedAgain
08-18-2004, 05:59 AM
Greetings from Saskatoon.
It might be KDE using it's default instead of system setting. Try rt clk on the time display & make sure timezone is set for local time. Check also that time is correct after the rest of the world switches to daylight saving time.

el_supremo
08-18-2004, 06:13 PM
Greetings from Saskatoon.
Greetings from Saskatoon to you too :-) I was only using America/Regina because there's no America/Saskatoon option.


It might be KDE using it's default instead of system setting.

I set the correct date/time and timezone and then saved configs, which saves /etc/localtime. That combined with specifying tz=America/Regina at the boot prompt should set the correct date/time and timezone but it doesn't.
The date program shows local time (CST) as two hours too early. Something is still forcing EDT when it boots and I can't find it.


Try rt clk on the time display & make sure timezone is set for local time.
It is set for local time but that only affects how the clock is interpreted.
When I'm using the satellite prediction software the thing that counts is that the date program prints out the correct date/time and timezone because it uses the same system calls to get the date/time as the prediction software.

Best Wishes
Pete

el_supremo
08-18-2004, 10:19 PM
There is a bug in the way that the /etc/knoppix-autoconfig script handles the tz cheatcode.
It does not read that cheatcode, and set TZ from it, until after the system clock has been set with the hwclock command.
This block of code:


KTZ="$(getbootparam tz 2>/dev/null)"
[ -f "/usr/share/zoneinfo/$KTZ" ] && TZ="$KTZ"
rm -f /etc/localtime
cp "/usr/share/zoneinfo/$TZ" /etc/localtime

should be moved before this block of code:


# hwclock uses the TZ variable
export TZ
hwclock $UTC -s

so that the tz= cheatcode will override whatever timezone default was set by the lang= cheatcode.

Best Wishes
Pete (now definitely on CST :-)