*BSD News Article 10079


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA7169 ; Mon, 18 Jan 93 10:49:13 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!natinst.com!hrd769.brooks.af.mil!hrd769.brooks.af.mil!not-for-mail
From: burgess@hrd769.brooks.af.mil (Dave Burgess)
Newsgroups: comp.unix.bsd
Subject: Re: problems with date
Date: 14 Jan 1993 13:55:42 -0600
Organization: Armstrong Lab MIS, Brooks AFB TX
Lines: 56
Message-ID: <1j4gfuINNpme@hrd769.brooks.af.mil>
References: <1iu2jsINN518@fbi-news.Informatik.Uni-Dortmund.DE> <1993Jan14.064517.7201@st.simbirsk.su>
NNTP-Posting-Host: hrd769.brooks.af.mil

In article <1993Jan14.064517.7201@st.simbirsk.su> cliff@st.simbirsk.su (Viacheslav Andreev) writes:
>Ulrich Joergens (PG211) (joergens@snorre.informatik.uni-dortmund.de) wrote:
>: 'yesterday' so I'm 24 hours to late. The timezone in my config file is set
>I have the same trouble (timezone is set to -3 dst).
>

  This was noticed about two weeks ago (like the 1st of January) and patched
(two different ways).  There should be a consolidated patch in the patch kit
shortly.  
  The problem is in the leap year computation.  I don't have the patch anymore,
but suggest you look in one of the sites that archives messages and look for
one of the patches from the 1st of January.
  Here is the diff file for my clock.c (it includes patch00044)

============================ cut here ====================================
36a37,44
>  *
>  * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
>  * --------------------         -----   ----------------------
>  * CURRENT PATCH LEVEL:         1       00044
>  * --------------------         -----   ----------------------
>  *
>  * 14 Aug 92	Arne Henrik Juul	Added code for the kernel to
>  *					allow for DST in the BIOS.
52a61,62
> #define isleap(y) (((y) % 4) == 0 && ((y) % 100 != 0) || ((y) % 400) == 0)
> 
89,92c99,104
< 	ret = 0; y = y - 70;
< 	for(i=0;i<y;i++) {
< 		if (i % 4) ret += 365*24*60*60;
< 		else ret += 366*24*60*60;
---
> 	ret = 0;
> 	for(i=1970; i < y; i++) {
> 		if (!isleap(i)) 
> 		    ret += 365*24*60*60;
> 		else 
> 		    ret += 366*24*60*60;
140,141c152,153
< 	sec = bcd(rtcin(RTC_YEAR));
< 	leap = !(sec % 4); sec += ytos(sec); /* year    */
---
> 	t = bcd(rtcin(RTC_YEAR)) + 1900;
> 	leap = isleap(t); sec = ytos(t); /* year    */
148d159
< 	sec -= 24*60*60; /* XXX why ??? */
150d160
< #ifdef notdef
154c164
< 	yd = yd / 24*60*60;
---
> 	yd = yd / (24*60*60);
158d167
< #endif