home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / bsd / 11972 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.7 KB  |  41 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!seunet!dynas!micke
  3. From: micke@dynas.se (Mikael Hybsch)
  4. Subject: Re: [386bsd] New patch00071 is slightly wrong
  5. Message-ID: <1993Jan28.160239.16048@dynas.se>
  6. Sender: news@dynas.se (News Administrator)
  7. Organization: DynaSoft, Dynamic Software AB
  8. References: <bIQKePhq40@astral.msk.su>
  9. Date: Thu, 28 Jan 1993 16:02:39 GMT
  10. Lines: 29
  11.  
  12. In <bIQKePhq40@astral.msk.su> "Andrew A. Chernov, Black Mage" <ache@astral.msk.su> writes:
  13.  
  14. >I just look into new patch00071 of clock.c and found small bug,
  15. >it don't calculate leap year properly, produce error in 2000 year.
  16.  
  17. The rule "year % 4" will work until year 2100, because (2000 % 400) is 0.
  18. Of course we still want our grand children to be able o use the correct time
  19. when they play with 386bsd.
  20.  
  21. >!     if (sec < 1970)
  22. >!         sec += 100;
  23. >!     leap = !(sec % 4); sec = ytos(sec); /* year    */
  24.  
  25. >Correct way to calculate leap year is:
  26.  
  27. >#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
  28.  
  29. >see for example /usr/include/tzfile.h
  30. >-- 
  31. >In-This-Life:  Andrew A. Chernov    |  "Hay mas dicha, mas contento
  32. >Internet:      ache@astral.msk.su   |  "Que adorar una hermosura
  33. >FIDOnet:       2:5020/23.34         |  "Brujuleada entre los lejos
  34. >Organization:  The RELCOM Corp.     |  "De lo imposible?!"  (Calderon)
  35.  
  36. -- 
  37.  Mikael Hybsch                        Email: micke@dynas.se
  38.  DynaSoft, Dynamic Software AB        Phone: +46-8-615 84 00
  39.  Hammarby Fabriksv 13, Box 92058      Fax:   +46-8-641 92 00
  40.  S-120 06 STOCKHOLM, SWEDEN
  41.