Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Incorrect TimeZone usage in prompts - bug?



Andrew Main <zefram@xxxxxxxxx> typed:
:Andreas Sigfridsson wrote:
:>I like to have the time being displayed in my prompt, but on both my Linux
:>computers, they display the wrong time. I live in Sweden where whe have CET,
:>but zsh displays GMT. Being quite a novice on Unix/Linux I understand that
:>system time can be represented in the computer in two different ways. Either
:>the actual local time, or GMT with a timezone. I guess I use the latter one,
:>and I cannot change, because I run Windows on the same computer. Is it
:>possible that zsh just takes the clock and uses it regardless of the
:>timezone?
:This is tricky.
:
:The Unix model of timekeeping is that the kernel maintains a count of
:the number of seconds since the epoch, which is 1970-01-01 midnight UTC.
:When displaying a time, library functions examine the environment variable
:TZ, and display the time relative to this timezone.
:
:The Windoze model of timekeeping is that the kernel knows the current
:date and time of day, for the current timezone.  This kernel clock needs
:to change whenever DST causes a change of timezone.
:
:These two models are fundamentally inconsistent, so you're just asking for
:trouble in trying to use both of them on the same machine.  This being
:a PC, you're further affected by the fact that the PC's hardware clock
:actually keeps track of date and time, and has no idea of timezone.

Does Linux have a compile option (or otherwise) to specify an offset of the
real time clock?  NetBSD does so that on my (home) computer I run
NetBSD/Win95/WinNT happily with xntpd running on NetBSD & WinNT (well, except
for Microsoft's daylight-savings timezone stuffup for people in many
parts of Australia).  Maybe you need to convince Linus or whoever is in 
charge of the kernel these days about its usefulness.

As for what to do in the meantime, set all your clocks, watches and everything
else to GMT, and then you won't have to worry about setting up zsh especially
at all :-)
-- 
Geoff Wing   <gcw@xxxxxxxxx>            Mobile : 0412 162 441 
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/



Messages sorted by: Reverse Date, Date, Thread, Author