time is wrong, despite time zone set via tzconfig


Forum: DSL Embedded
Topic: time is wrong, despite time zone set via tzconfig
started by: robertakit

Posted by Guest on June 21 2007,18:51
I finally discovered that my system was using EDT (Eastern Daylight Time) rather than my current time zone (PDT).

I used "tzconfig" to fix it and added etc/localtime to my .filetool.lst file.  Now, whenever it boots, the time is incorrect -- it's 3 hours too early.

Is there an easy way to repair/fix this?

Posted by roberts on June 21 2007,19:19
Don't need to run that or save that file. Instead use boot code:

tz=US/Pacific

If you have net access use the command

$ sudo gettime.lua

to set time from time server.

If you normally boot with net access then add gettime.lua to /opt/bootlocal.sh like this

/usr/local/bin/getttime.lua

Then upon boot I have accurate time set.

Posted by Guest on June 21 2007,20:13
[quote=roberts,June 21 2007,15:19][/quote]
The boot code didn't work, but the gettime.lua trick does.

Thanks.

Posted by roberts on June 21 2007,22:31
All of my frugal installed machines use such boot code in the grub menu. The boot code existed before the gettime.lua code.
Posted by Guest on June 21 2007,22:37
Ah, I don't use grub.  Perhaps that's the problem.  I just use QEMU to boot directly into DSL.
Posted by roberts on June 22 2007,00:26
Ah, perhaps it is the special character "/" that the bat file doesn't like. My windows aren't big enough to really run Qemu well. Maybe if you escape it?
Posted by Guest on June 22 2007,00:33
I don't think that's the problem.  When it actually comes up, and I type date, it correctly says PDT.  So, it's catching the right stuff.  It's just that the time is wrong.

Perhaps QEMU is not catching the fact that the host (Windows XP) is in the PDT time zone.  Or something like that.  Anyway, it's exactly 3 hours off, which makes me think that something thinks that I'm on the east coast :-).

Posted by Juanito on June 22 2007,09:58
I've been struggling with the logic of this for a while now:
Code Sample
# gettime.lua
Requesting time from: time-nw.nist.gov
Fri Jun 22 09:33:47 UTC 2007 [this is correct]

# date
Fri Jun 22 05:43:46 EDT 2007

But, when I try and enter the correct time zone:
Code Sample
# tz=GMT+4
# date
Fri Jun 22 05:44:13 EDT 2007

or:
Code Sample
# tzselect
/usr/bin/tzselect: line 23: /usr/share/zoneinfo/iso3166.tab: No such file or directory
/usr/bin/tzselect: time zone files are not set up correctly

We could save 5,862 bytes in DSL by deleting tzselect...

Finally, if I load libc6, I get this:
Code Sample
# tzconfig
...
Name: [] GMT+4
Your default time zone is set to 'Etc/GMT+4'.
Local time is now:      Fri Jun 22 05:49:53 GMT+4 2007. [incorrect]
Universal Time is now:  Fri Jun 22 09:49:53 UTC 2007. [correct]

# date
Fri Jun 22 05:51:00 GMT+4 2007

Needless to say, if my timezone is GMT+4, the local time should be 13:49...

Note:
Code Sample
# cat /etc/default/rcS

TMPTIME=0
SULOGIN=no
DELAYLOGIN=yes
UTC=no [i.e. hwclock=localtime]
VERBOSE=yes
EDITMOTD=no
FSCKFIX=no

Posted by roberts on June 22 2007,14:26
The offset method as you are trying to use is not supported in DSL.

Witness the fact, that to include all possible zoneinfo, as in Knoppix 3.4 is 1.6MB versus the limited zoneinfo by named zones is only 43k  in DSL.

We have had the debate about which method to use in the past. In fact DSL originally only had EDT timezone. Later, I added in the US timezones. And finally the DSL community suggested that I at least add the named zones as specifically specified within knoppix-autoconfg boot options. This explains the what and why of DSL timezones. You can see such zones available by perusing /usr/share/zoneinfo/  

Perhaps an extension could be made from the original Knoppix /usr/share/zoneinfo, but it would need to be the complement otherwise it would overwrite the new daylight saving time rules which are in DSL.

Posted by ^thehatsrule^ on June 27 2007,02:25
robertakit: I noticed from your other thread that you were using qemu with -localtime AND using tz= ... perhaps only using either one will solve your problem
Quote
-localtime      set the real time clock to local time [default=utc]

Posted by Juanito on Sep. 24 2007,14:08
Quote
Perhaps an extension could be made from the original Knoppix /usr/share/zoneinfo, but it would need to be the complement otherwise it would overwrite the new daylight saving time rules which are in DSL.

- I just tried this by copying over the contents of /usr/share/zoneinfo, /usr/bin/tzselect and /usr/sbin/tzconfig from the knoppix iso.

I tried the boot code tz=Etc/GMT+4 but that didn't work (stays at EDT). Using tzconfig and GMT+4 gave UTC as 4 hours ahead rather than 4 hours behind. Using tzconfig and Moscow (in the same timezone) gave local time as 4 hours ahead and UTC as 8 hours ahead.

There must be another file(s) I'm missing?

Posted by jpeters on Sep. 25 2007,06:44
Quote (roberts @ June 21 2007,15:19)
/usr/local/bin/getttime.lua

Then upon boot I have accurate time set.

It's interesting to also load < www.time.gov > and watch just how accurate the clock is....i'm impressed.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.