From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079091516298.tru64-unix-managers.marc@archive.invalid> From: Danielle Georgette Date: Mon, 13 Dec 1999 01:31:01 +0000 To: tru64-unix-managers Subject: Summary: Y2K trickiness X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079091516298 Well the responses on this one were bigger than Ben Hur. I received more information than I thought it was possible to have on the issue ( including almost all the possible approaches to algorithms - thank you ), had fun leaning about the Julian and Gregorian calendars, and leant a new word ( "nutation" see Stuart McKenzies' summary). All in all, a plethora of wisdom. Don't read through it if you can't spare at least 15 mins ! Note: for Mr HemphillM@mar.dfo-mpo.gc.ca - your solution was different from the universal consensus. I'd re-check it perhaps if I were you .... Thanks to: Larry Garrett [Larry_Garrett@csx.com] Peter.Stern@weizmann.ac.il Wigg, David [David.Wigg@getronics.com] C.Ruhnke [i769646@smrs013a.mdc.com] Bob Vickers [bobv@dcs.rhbnc.ac.uk] fhauers@rke.de Richard Rogers [R.M.Rogers@staffs.ac.uk] Dipl.-Phys. S. Richter, IKP, Tel. 16-5152 [SIMONE@ikp.tu-darmstadt.de] Nikola Milutinovic [Nikola.Milutinovic@ev.co.yu] trey@ministry.eu.org Tame, Richard [richard.tame@compaq.com] alf@northpower.com.au Robert Mulley [genius@one.net.au] alan@nabeth.cxo.dec.com kevin@meso.com Hoover, Tony [hoover@sal.ksu.edu] stan [stan@astro.temple.edu] And those who provided a little extra, or something else of interest .... Lucio Chiappetti [lucio@ifctr.mi.cnr.it] - all years divisible by 4 are leap, but - years divisible by 100 (1700, 1800, 1900) are NOT leap, but - years divisible by 400 (1600, 2000) are leap A great place to look is http://www.tondering.dk/claus/cal/calendar21.html You should find a good encyclopedia with a section on "perpetual calendars". I used my old Science & Technology Encyclopedia (in italian, but there should be also a McGraw Hill edition) long ago to write the enclosed Fortran program which produces a calendar for any year (both julian and gregorian). Steve Thompson [smt@NICS1.corning.com] 1. year divisible by 4? no -> not a leap year; yes -> go to #2 2. year divisible by 400? yes -> is a leap year; no -> go to #3 3. year divisible by 100? yes -> not a leap year; no -> is a leap year Daniel Monjar [dmonjar@monjard.orgtek.com] http://www.amherst.edu/~atstarr/leapday.html Jim Fitzmaurice [jpfitz@fnal.gov] The length of a year is actually 365.24219 days not 365.25 days as is commonly thought, so a leap year is evenly divisible by 4. But that would throw off the calendar by about 3 days every 400 years so the last day of the century, e.g.. 1800, 1900, 2000, 2100 is not a leap year unless it's evenly divisible by 400. This effectively makes the average length of the year 365.2425 days. The difference between this length and the true length will not have a serious effect for thousands of years, about 3 days in 10,000 years in fact. But Tru64-UNIX and all other flavors of UNIX that I have encountered are aware of this, Type in "cal 1900" and you will see that February only has 28 days. UNIX also smart enough to know that in September of 1752 Britain and her colonies adopted the Gregorian calendar and the 365.2425 day year. Enter the command "cal 1752" and check out September. You'll see the month only has 24 days, September 2nd is followed by September 14th.(It was a leap year as well.) So you don't have to worry about it if you use UNIX commands to get your dates, "date" and "cal" You could write a script to do the math, or use the "cal" command in a simple script like: #!/bin/ksh if cal 02 $1 | grep 29 > /dev/null then echo "\n$1 is a leap year.\n" else echo "\n$1 is not a leap year.\n" fi This is the quickest way I know to check for a leap year. UNIX knows, so just ask it. Dyer, Steve J. [Steve.Dyer@alcoa.com] See http://www.nrc.ca/inms/faq/time.html. It explains the rules very well. HemphillM@mar.dfo-mpo.gc.ca leap years are years divisible by 4 except years divisible by 100 are not leap years except years divisible by 1000 are leap years except years divisible by 10000 are not leap years This adjusts for extra quarter day + 11 minutes in the solar year. This keeps the calendar in synch with great accuracy. The scheme was devised by the Jesuit mathematician and astronomer Cristoph Clavius in the time of Pope Gregory XIII [1582]. managers account [managers@2100-1.mcb.net] The creeping is actually due to nutation - the 'wobbling' action of the earth's axis. regds stuart mckenzie Jean-Louis Oneto [oneto@obs-azur.fr] You could have a look on the following page: http://www.as.wvu.edu/~jel/skywatch/skw9602a.htm or on http://an2000.univ-lille1.fr/an2000/Fond/CalendrierGregorien.htm if you are not allergic to French ;-) Have a nice day and next century/millenium (which only begins on Jan 1st, 2001 by the way !) Ian Mortimer [ian@physics.uq.edu.au] I just worked this out off the top of my head so you should check it but I think this is correct: All years including leap years repeat on a 28 year cycle. A year which follows a leap year will repeat in 6 years. A year before a leap year or a year half way between leap years will repeat in 11 years. The only time this will fail is when you cross a century that isn't a leap year. That won't happen until 2100. We should live that long! Regards Ian Kundert, Robin [rkundert@spu.edu] If [the year is divisible by 4] Then If [the year is divisible by 100] Then If [the year is divisible by 400] Then Else If End Else Else If End Herman_Fredriksson@perpetual.com.au Hi Danielle, Here is a classic C fragment from K&R's "The C Programming Language" if ( ( year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { /* the year is a leap year */ } else { /* it isn't */ } Frank Wortner [frank@bondnet.com] As far as "rolling back" to 1972, I would be very cautious about doing this. Many commands are time sensitive, and you might be creating worse problems than the ones you are trying to "solve." Wendy Fong [wfong@synacom.com] Check out this website: http://www.mnsinc.com/utopia/Calendar/Year_Correlations.html Mark.Scarborough@broadwing.com All this mess really boils down to is to make the length of the average year closer to the actual length of the solar year. If every 4 years you have a leap year, the average year length is: ((365+365+365+366) / 4) or 365.25. If you disallow all century years (years ending in "00") the average becomes: (((76 * 365) + (24 * 366)) / 100) or 365.24. If you then add back in the years divisible by 400 the average becomes: (((303 * 365) + (97 * 366)) / 400) or 365.2425 which is fairly accurate. Now all they have to do is add "leap seconds" every once in a while to keep up. Check out the National Institute of Standards if you want to verify: http://www.nist.gov/y2k/leapyear.htm You can also find information on why the year 2000 is not the first year of the new millennium but that is a different soap box... Hope this helps! Mark Daniel West [west.daniel@epa.gov] Check out the following URLs http://www.amherst.edu/~atstarr/leapday.html http://astro.nmsu.edu/~lhuber/leaphist.html Steve VanDevender [stevev@hexadecimal.uoregon.edu] You may find the unix 'cal' command useful for examining calendar patterns. In general the calendar follows a 28-year cycle, broken up slightly by those century non-leap years. Pirie Hart [pirie@u.washington.edu] if (mod(year,400) == 0) then year is leap year else if (mod(year,100) == 0) then year is NOT leap year else if (mod(year,4) == 0) then year is leap year else year is NOT leap year Jerry Marty [jerrym@zoomtel.com] If you look at the compaq web site in the Y2K readiness program section, they have a nice little flowchart that tells you the algorithm for determining what's a leap year and what's not...I can't find it just now, but when I was digging around for info on my alphaservers and various revs of Dec UNIX, I ran into it a few times, so it's gotta be in there somewhere.