zsh-users
 help / color / mirror / code / Atom feed
* Incorrect TimeZone usage in prompts - bug?
@ 1998-03-03 20:30 Andreas Sigfridsson
  1998-03-04  9:47 ` Andrew Main
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Sigfridsson @ 1998-03-03 20:30 UTC (permalink / raw)
  To: zsh-users

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?

(All other programs show the time correctly)

/Andreas Sigfridsson



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Incorrect TimeZone usage in prompts - bug?
  1998-03-03 20:30 Incorrect TimeZone usage in prompts - bug? Andreas Sigfridsson
@ 1998-03-04  9:47 ` Andrew Main
  1998-03-06  5:36   ` Geoff Wing
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Main @ 1998-03-04  9:47 UTC (permalink / raw)
  To: Andreas Sigfridsson; +Cc: zsh-users

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Incorrect TimeZone usage in prompts - bug?
  1998-03-04  9:47 ` Andrew Main
@ 1998-03-06  5:36   ` Geoff Wing
  1998-03-06  9:45     ` Bruce Stephens
  0 siblings, 1 reply; 4+ messages in thread
From: Geoff Wing @ 1998-03-06  5:36 UTC (permalink / raw)
  To: zsh-users

Andrew Main <zefram@tao.co.uk> 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@pobox.com>            Mobile : 0412 162 441 
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Incorrect TimeZone usage in prompts - bug?
  1998-03-06  5:36   ` Geoff Wing
@ 1998-03-06  9:45     ` Bruce Stephens
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Stephens @ 1998-03-06  9:45 UTC (permalink / raw)
  To: zsh-users

mason@primenet.com.au said:
> 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 :-) 

Yeah.   Works for me (during the winter, anyway).

-- 
Bruce Stephens	B.Stephens@isode.com
Isode Ltd.	<URL:http://www.isode.com/>




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-03-06 10:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-03 20:30 Incorrect TimeZone usage in prompts - bug? Andreas Sigfridsson
1998-03-04  9:47 ` Andrew Main
1998-03-06  5:36   ` Geoff Wing
1998-03-06  9:45     ` Bruce Stephens

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).