zsh-users
 help / color / mirror / code / Atom feed
From: Andrew Main <zefram@tao.co.uk>
To: andsi988@student.liu.se (Andreas Sigfridsson)
Cc: zsh-users@math.gatech.edu
Subject: Re: Incorrect TimeZone usage in prompts - bug?
Date: Wed, 4 Mar 1998 09:47:27 +0000 (GMT)	[thread overview]
Message-ID: <199803040947.JAA23744@taos.demon.co.uk> (raw)
In-Reply-To: <01bd46e3$37feae00$e3efec82@h227.ryd.student.liu.se> 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


  reply	other threads:[~1998-03-04 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-03 20:30 Andreas Sigfridsson
1998-03-04  9:47 ` Andrew Main [this message]
1998-03-06  5:36   ` Geoff Wing
1998-03-06  9:45     ` Bruce Stephens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199803040947.JAA23744@taos.demon.co.uk \
    --to=zefram@tao.co.uk \
    --cc=andsi988@student.liu.se \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).