Hi there, I found a little quirck while playing around with the Y2K
problem. I got an apetite for overrun problems, and I was looking for
some variations. I found out my '93 motherboard switches from 31/12/1997
to 01/01/1997. Great. :-)
Then I found this:
---------- Forwarded message ----------
Date: Wed, 31 Dec 1997 00:03:40 +0100 (MET)
From: Wim Vandeputte <bunbun(a)reptile.rug.ac.be>
To: Theo de Raadt <deraadt(a)cvs.openbsd.org>
Subject: Month 53 bug?
eh, this is weird. OpenBSD 2.2 GENERIC#81 i386
date +%W
gives 52
date +%V
gives 53.
is *this* 53'th week of the year?
On SunOS 5.5 (Generic_103093-08 sun4d sparc SUNW,SPARCserver-1000) both
give 52.
On SunOS 5.5.1 (sun4u sparc SUNW,Ultra-1) %V gives 53, %W gives 52.
On Linux, +%W gives 52, +%V gives 01
The manpage of strftime says that if the week containing Jan 1 has four
or more days in the new year, then it is week 1. This week gives:
Thursday (1/1), Friday (2/1), Sat (3/1), Sun (4/1) = 4 days in the new year.
So date +%V should produce 1 instead of 53, right?
This must be some lib thing....
*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*
Wim Vandeputte --Comfort is Treachery--
--So pound the nails in tight--
His first reply:
>From deraadt(a)cvs.openbsd.orgWed Dec 31 00:32:18 1997
Date: Tue, 30 Dec 1997 16:05:14 -0700
From: Theo de Raadt <deraadt(a)cvs.openbsd.org>
To: Wim Vandeputte <bunbun(a)reptile.rug.ac.be>
Cc: millert(a)cvs.openbsd.org
Subject: Re: Month 53 bug?
Hmm, interesting problem.
It is possible that some of these systems have an old timezone
library. And it is possible that our man page is wrong. Or that our
code is wrong, since we don't have the very very latest version of the
timezone code (we are about a year out of date with respect to the
timezone code, but a cursory examination shows that not much has
changed, and we've fixed a few bugs ourselves).
> nor more days in the new year, then it is week 1. This week gives:
> Thursday (1/1), Friday (2/1), Sat (3/1), Sun (4/1) = 4 days in the new year.
Wait, isn't Sunday the first day of the next week? Then it's 3 days
in the next week. Ie, look at this:
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5 6
5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
See?
So I think we are right:
I think SunOS 5.5 had it wrong,
Linux has it wrong,
and both SunOS 5.5.1 and OpenBSD 2.2 get it right.
Do you now concur?
------------------------------------------------------------------------
I wrote back:
>From bunbun(a)reptile.rug.ac.beWed Dec 31 00:34:13 1997
Date: Wed, 31 Dec 1997 00:20:20 +0100 (MET)
From: Wim Vandeputte <bunbun(a)reptile.rug.ac.be>
To: Theo de Raadt <deraadt(a)cvs.openbsd.org>
Subject: Re: Month 53 bug?
On Tue, 30 Dec 1997, Theo de Raadt wrote:
> Wait, isn't Sunday the first day of the next week? Then it's 3 days
> in the next week. Ie, look at this:
the man page (old or faulty?) says that "(Monday as the first day of the
week)". ^^^^^^^^^^^^^-> the SunOS page says the same.
That makes the week go from Mon -> Sun, thus still four days in this week
in the next year.
Confuse me :-) please (it's running late here :-)
*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*-=-*
Wim Vandeputte --Comfort is Treachery--
--So pound the nails in tight--
His reply to this:
>From deraadt(a)cvs.openbsd.orgWed Dec 31 00:32:24 1997
Date: Tue, 30 Dec 1997 16:17:40 -0700
From: Theo de Raadt <deraadt(a)cvs.openbsd.org>
To: Wim Vandeputte <bunbun(a)reptile.rug.ac.be>
Cc: millert(a)cvs.openbsd.org
Subject: Re: Month 53 bug?
Please never remove cc:'s
> > Wait, isn't Sunday the first day of the next week? Then it's 3 days
> > in the next week. Ie, look at this:
>
> the man page (old or faulty?) says that "(Monday as the first day of the
> week)". ^^^^^^^^^^^^^-> the SunOS page says the same.
>
> That makes the week go from Mon -> Sun, thus still four days in this week
> in the next year.
Ok. Perhaps this is a flaw then. We need to find out which way that
needs to work, then. Do you want to do some more research by
contacting the people who wrote the library in question?
Yeah you do! Go for it: contact tz(a)elsie.nci.nih.gov and keep us
informed OK?
--------------------------------------------------
So, this brings me to you... what's the next step?