Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Incorrect TimeZone usage in prompts - bug?
- X-seq: zsh-users 1369
- From: Andrew Main <zefram@xxxxxxxxx>
- To: andsi988@xxxxxxxxxxxxxx (Andreas Sigfridsson)
- Subject: Re: Incorrect TimeZone usage in prompts - bug?
- Date: Wed, 4 Mar 1998 09:47:27 +0000 (GMT)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <01bd46e3$37feae00$e3efec82@xxxxxxxxxxxxxxxxxxxxxxx> from "Andreas Sigfridsson" at Mar 3, 98 09:30:34 pm
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.
The usual compromise is to set the hardware clock to the current GMT time,
and in Windoze select GMT (and disable DST -- MS misuse the term "GMT"
to mean "current civil timezone in the UK"). In Windoze, therefore,
you get just UTC times, and under Linux you get whatever timezone you
select with $TZ. You should make sure you are setting and exporting
that parameter in your startup files.
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author