9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Re: Some plan9 y2k problems
@ 1999-01-14 16:10 presotto
  0 siblings, 0 replies; 3+ messages in thread
From: presotto @ 1999-01-14 16:10 UTC (permalink / raw)


Actually, depending on where you looked, the previous
code did have the algorithm right in dysize, i.e., leap
year every fourth year except every 100th year except every
400th year.  However by subtracting 1900 from the date,
calls to dysize treated the year 2000 as the year 100 and
therefore a multiple of 100 and not 400 and therefore not
a leap year.

As someone pointed out earlier, this should have been in
a library.  In some places we were saved by stupidity and
in some cursed by it.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] Re: Some plan9 y2k problems
@ 1999-01-14 15:33 Russ
  0 siblings, 0 replies; 3+ messages in thread
From: Russ @ 1999-01-14 15:33 UTC (permalink / raw)



  Unless someone changes time's type to "unsigned long" or "long long"
  before 2038...

I'm guessing that by 2038, time()'s type will be at least 64 bits.
I think we can scrounge up a factor of two in the next 40 years.
Just a hunch.

  It's not a bug, it's a feature!  Because of the year%400 rule, the year
  2000 *is* a leap year.  Therefore, between March 1, 1900 and Feb. 28,
  2100, the year%4 rule alone is valid.  UNIX's time span is well within
  this range.

No doubt this will go down in history as one
of the earliest justifications of the infamous y21c bug.
In 100 years, we will look back in disgust at the "foolish
Unix programmers" who thought that their code would certainly
be retired in the next 100 years.  And why stop there?  At this
rate we should all be preparing for the y10k bug, which certainly
will be much more disruptive than whatever happens in 11½ months.

Russ




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] Re: Some plan9 y2k problems
@ 1999-01-14 10:38 amos
  0 siblings, 0 replies; 3+ messages in thread
From: amos @ 1999-01-14 10:38 UTC (permalink / raw)


(I posted this on the plan9 newsgroup, but it isn't gated back to the
9fans list.  Apologies for those who see this twice).

presotto@plan9.BEll-labs.COM writes:

>In case anyone cares...

>They all involve screw ups in figuring out leap years.
>The ctime.c one is stupidly calls dysize with the year
>minus 1900 instead of the year.

It's not a bug, it's a feature!  Because of the year%400 rule, the year
2000 *is* a leap year.  Therefore, between March 1, 1900 and Feb. 28,
2100, the year%4 rule alone is valid.  UNIX's time span is well within
this range.

Unless someone changes time's type to "unsigned long" or "long long"
before 2038, there's no need to bother the system with code that will
only be executed once in 100 years, and even then come up with the same
result as existing code!

--
	Amos Shapir
Paper: nSOF Parallel Software, Ltd.
       Givat-Hashlosha 48800, Israel
Tel: +972 3 9388551   Fax: +972 3 9388552        GEO: 34 55 15 E / 32 05 52 N




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-01-14 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-14 16:10 [9fans] Re: Some plan9 y2k problems presotto
  -- strict thread matches above, loose matches on Subject: below --
1999-01-14 15:33 Russ
1999-01-14 10:38 amos

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).