*BSD News Article 16391


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!bruce.cs.monash.edu.au!monu6!escargot!otto!davidb
From: davidb@otto.bf.rmit.oz.au (David Burren [Athos])
Newsgroups: comp.os.386bsd.bugs
Subject: Re: Fix to clock probs [was Re: CMOS clock is incorrectly handled]
Date: 22 May 93 11:23:00 GMT
Organization: Royal Melbourne Institute of Technology
Lines: 60
Message-ID: <davidb.738069780@otto>
References: <1993May18.165711.3527@alw.nih.gov> <1tk1bfINN383@escargot.xx.rmit.OZ.AU>
NNTP-Posting-Host: otto.bf.rmit.oz.au

In <1tk1bfINN383@escargot.xx.rmit.OZ.AU> s902113@minyos.xx.rmit.OZ.AU (Luke Mewburn) writes:

> You have to 
> a) calculate the offset to gmt to where you are in hours. This is the
>    value you use in the 'timezone xxx' line in /sys/i386/conf/WHATEVER.
>    (e.g, 'timezone 10')

Luke, the "correct" definition for the East coast of Australia is
	timezone	-10 dst 2

Note that the timezone field can have a fractional part.  The figure is
multiplied by 60 before being used in the kernel compile.

This is what is traditionally done with a real machine architecture, but
as the kernel's going to assume the BIOS is in local time, it's going
to have to do local conversion to work out its idea of UTC (using its
limited inbuilt rules) which is prone to error.


> c) sym link /etc/localtime to /usr/share/timezone/wherever/you/are
>    (e.g, /usr/share/timezone/Australia/Victoria)

It's actually /usr/share/zoneinfo/..., but you've got the idea.

You can also set the timezone on a per-process basis by setting the TZ
environment variable to a name relative to the zoneinfo directory, such
as "Australia/Victoria".  /etc/localtime is used when TZ is not set.


> What I _know_ works is
> setting the kernel's idea of timezone in the config file to 0 (gmt),
> setting the bios time to gmt, and then symlinking in
> /usr/share/timezone/Australia/Victoria to /etc/localtime.

This is what I see as the "correct" way to do it on a PC, but it will
upset people who try to run MeSsy-DOG on the same machine.


> I will test out the 'setting timezone to 10 hours and putting my
> bios clock to the _real_ time here' trick tonight and follow up this
> post if I'm wrong.

I did this for a while, and found that it was an hour out.  I've switched
to using a kernel timezone of 0 and am so far still looking for problems.

Having two settings of timezone (one inside the kernel and one in
user space) has been recognised for a while as being a flaw.

Some Unixes really screw up, such as Ultrix in which /bin/date uses the
zoneinfo data to report the time, but the kernel's timezone info to set
the time.  I logged this with DEC as a bug in 4.2 and it still hasn't
been fixed (but then, Ultrix's zoneinfo implementation is a bit weird).
__
David B.
 davidb@otto.bf.rmit.oz.au

PS.	Anyone want to help me sort out an uptodate australasia zoneinfo
	file for the next NetBSD release?  The one in the 0.8 distribution
	is way old.  I have one from some local Sun people about two years
	ago, but things have changed since then and I'm trying to clean it up.