🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.linux.development.system
Article #27

Re: A whacky DATE bug in Linux - SOLVED!

#27
From: Peter B. West
Date: Tue, 29 Sep 1998 00:00
59 lines
3829 bytes
Ron House wrote:
> 
> Thanks to all the kind people who volunteered their suggestions to help
> me with this problem. I have now found the solution. It was Doug Moir
> who put me onto the right answer with this suggeestion:
> 
> >There is a bug in the program clock(8) (often found in /sbin)----- it
> >miscounts a timezone offset and confuses seconds with minutes or some
> >such.------- get a new version of the clock program.
> 
> I wanted to find out whether this was the problem. Luckily, Harald
> Hoffmann told me how to set and inquire about the kernel's internal
> variable, sys_tz:
> 
> >sys_tz can be set with settimeofday().
> 
> >Try this C program:
> 
> Harald's program didn't quite work, but the failure of the clock program
> to set sys_tz was indeed the cause, as gettimeofday() reported the
> timezone offset as 0.
> 
> I devised a program based on Harald's to apply a -10 hour correction (as
> Australia is east of Grenwich). Anyone with this problem west of there
> should apply a positive correction. Unfortunately I seem to have failed
> to copy the directory with the program, so I'll post it tomorrow.

I must be missing something.  How can /sbin/hwclock --show,
/sbin/hwclock --show --utc, date, date -u, and the perl gmtime and
localtime calls all do the right thing if the kernel doesn't know what
is going on?  (Note that /sbin/clock is a link to /sbin/hwclock.)

I took Harald's advice and RTM.  Herewith from the man page
  gettimeofday, settimeofday - get / set time

I am running RH5.1 2.0.34,  The man page is marked
`Linux 2.0.32 10 December 1997'

       struct timezone {
               int  tz_minuteswest; /* minutes W of Greenwich */
               int  tz_dsttime;     /* type of dst correction */
       };

       The use of the timezone struct is obsolete; the tz_dsttime
       field has never been used under Linux - it  has  not  been
       and  will  not  be  supported  by libc or glibc.  Each and
       every occurrence of this field in the kernel source (other
       than  the  declaration)  is  a bug. Thus, the following is
       purely of historic interest.

Now fair enough, the *field* tz_dsttime is completely unused, and is not
used in Harald's program.  But the man page claims that the `timezone
struct' is obsolete, not just tz_dsttime.  Caveat emptor.

Yours faithfully,
-- 
 __ /__   Peter B. West  p.west@uq.net.au
   /     http://www.uq.net.au/~zzpwest
  /     "Lord, to whom shall we go?"
Technical Details
Message-ID: <3610C608.9B8CEBC8@uq.net.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3601D4F7.247C8BC2@usq.edu.au> <3607ABBA.1952C377@uq.net.au> <36087C67.3313582C@usq.edu.au> <360bc2f5.0@198.161.96.27> <360F010E.70255666@usq.edu.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5392,12de531511895886
X-Google-Attributes: gidf5392,public
X-Google-Thread: 10c696,12de531511895886
X-Google-Attributes: gid10c696,public
X-Google-Thread: 102983,12de531511895886
X-Google-Attributes: gid102983,public
X-Google-Thread: f9b51,12de531511895886
X-Google-Attributes: gidf9b51,public
X-Google-Thread: faa64,12de531511895886
X-Google-Attributes: gidfaa64,public
X-Google-Thread: ff9be,12de531511895886
X-Google-Attributes: gidff9be,public
X-Google-Thread: f9382,12de531511895886
X-Google-Attributes: gidf9382,public
X-Google-Thread: 100c5f,12de531511895886
X-Google-Attributes: gid100c5f,public
From: "Peter B. West" <p.west@uq.net.au>
Subject: Re: A whacky DATE bug in Linux - SOLVED!
Date: 1998/09/29
Message-ID: <3610C608.9B8CEBC8@uq.net.au>
X-Deja-AN: 395947094
Content-Transfer-Encoding: 7bit
References: <3601D4F7.247C8BC2@usq.edu.au> <3607ABBA.1952C377@uq.net.au> <36087C67.3313582C@usq.edu.au> <360bc2f5.0@198.161.96.27> <360F010E.70255666@usq.edu.au>
Content-Type: text/plain; charset=us-ascii
Organization: Dis
Mime-Version: 1.0
Newsgroups: comp.os.linux.development.system,comp.os.linux.development.apps,comp.os.linux.setup,alt.linux,alt.os.linux,comp.os.linux,comp.os.linux.questions,aus.computers.linux