Slashdot Mirror


The Math of Leap Days

The Bad Astronomer writes "We have leap days every four years because the Earth's day and year don't divide evenly. But there's more to it than that... a lot more. A year isn't exactly 365.25 days long, and that leads to needing more complicated math and rules for when we do and don't have a leap year. If you've ever wanted to see that math laid out, now's your chance, and it only comes along every four years. Except every hundred years. Except every four hundred years."

51 of 225 comments (clear)

  1. Duh. by masternerdguy · · Score: 3, Funny

    There are no leap years. It's a conspiracy to cause IT nightmares and bratty kids who claim their age /= 4.

    --
    To offset political mods, replace Flamebait with Insightful.
    1. Re:Duh. by jellomizer · · Score: 2

      Not that much of a Nightmare, at least with modern Data classes. You take the month and year you are looking at. date(Year, Month+1, Day = 1) - 1 day. Then you get the last day of every month. Leap Year isn't the nightmare, The nightmare is the normal Month system with different days each month.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    2. Re:Duh. by kirkb · · Score: 4, Informative

      No, the REAL nightmare for programmers is daylight savings time. Especially in the spring, when local times jump back and repeat. Ugh.

      --
      Slashdot: come for the pedantry, stay for the condescension.
    3. Re:Duh. by egamma · · Score: 5, Insightful

      No, the REAL nightmare for programmers is daylight savings time. Especially in the spring, when local times jump back and repeat. Ugh.

      That's why you should save the time in UTC format, and then let the OS help you translate that into a display time.

    4. Re:Duh. by blueg3 · · Score: 3, Interesting

      UTC includes leap seconds. TAI does not.

    5. Re:Duh. by batkiwi · · Score: 4, Informative

      Here is one the UTC/DST problems in a nutshell, and why it's not as simple as you think:
      Assumptions:
      -Me and my user are in UTC +10
      -DST puts us into UTC +11
      -DST runs from 1 October until 1 April

      I am writing a "family reminders" application for mobile phones. A user enters two reminders. BOTH reminders are activated for the user and his wife, reminding them to take some medication. One is for 10 March 2010 at 1130AM and the other is for 10 April 2010 at 1130AM.

      How do I store these date? I am a SMART programmer, and I store them as 2012-03-10_0030 and 2012-04-10_0130.
      I was clever. I looked at the user's timezone setting, projected into the dates they were setting to appropriately modify the UTC time depending on DST or not.

      Two things happen:
      1. The user's wife flies to the west coast on 9 march, 3 hours earlier. On 10 march, do we alarm her at 8:30, per UTC? Or do we look at her new current time zone vs when it really was set and alarm her at 11:30 local time?

      2. The "making summer longer" act is passed, extending DST to 15 April. Do we alarm them at 11:30am, or at 12:30pm? Why?

      The solution to both of these is to give the users a bunch of checkboxes they don't quite understand, or to make assumptions that might wind up incorrect. Either way there's no "win win".

    6. Re:Duh. by Man+Eating+Duck · · Score: 2

      Not that much of a Nightmare, at least with modern Data classes. You take the month and year you are looking at. date(Year, Month+1, Day = 1) - 1 day. Then you get the last day of every month. Leap Year isn't the nightmare, The nightmare is the normal Month system with different days each month.

      Way too complicated :)

      Just convert whatever date or timestamp to/from Julian Day (the astronomical one, not ordinal day), and compare the results before and after. Very robust, functions exist in most languages (if not, the algorithm is trivial), and your dates are automagically validated. It will also handle the different-number-of-days-in-a-month problem for you.

      While you're at it: <rant>

      * If your data input expects dates in any formmats but ISO 8601, you're doing it wrong
      * If you're not using Unicode, you're doing it wrong (I blame English-centric programmers testing with lorem ipsum for this one)
      * If you must write a "char sep;"-separated input format, don't use any separator that WILL occur in normal text data (comma/semicolon-guys, I'm looking at you)
      * Document what you're expecting, don't leave me to guess...

      There are more issues which should be non-issues, but these simple rules should be beaten into every programmer's head the first day at any programming-related course, and every day after that. Just a few days ago I had the pleasure of writing code which dumped data from a well-structured DB to an accounting system which demanded two different (unspecified) date formats for two columns in the same freaking row, used semicolon separation even if there were obviously user-inputted "comment" fields (with no documented escapes), and croaked on Unicode input.

      </rant>, but seriously, the astronomical date thing makes date validation foolproof and throws in trivial arithmetic time period calculation for free in a portable manner. Check it out if you ever need to handle dates in your code.

      --
      Are you a grammar Nazi? I'm trying to improve my English; please correct my errors! :)
    7. Re:Duh. by xaxa · · Score: 4, Informative

      You mean universal? That just means a standard.

      A UTC formatted time stamp always contains a time zone

      No, it doesn't. It never contains one -- it always represents local solar time in Greenwich, London (without getting into detail only of interest to astronomers).

      However, it's often stored with a timezone, or processed using one. For example, RFC 2822 date format, which is what you get with
      $ date -R
      Thu, 01 Mar 2012 10:29:22 +0000

      I happen to be in London, so my timezone is +0000 right now.
      $ TZ=:Asia/Tokyo date -R
      Thu, 01 Mar 2012 19:31:12 +0900

      $ TZ=:Europe/London date -R -d 'now + 80 days'
      Sun, 20 May 2012 11:32:35 +0100
      (+0100, for British Summer Time)

      In these cases, what's being used is UTC and a location. The location (mine is set to Europe/London) is used to find the timezone offset for any particular date and time. This even takes into account historic (or known-future) changes:
      $ date -R -d '1941/07/01 12:00 +0000'
      Tue, 01 Jul 1941 14:00:00 +0200
      (Britain used "Double Summer Time" during World War 2)
      $ TZ=:Europe/Jersey date -R -d '1841/07/01 12:00'
      Thu, 01 Jul 1841 12:00:00 -0001
      (The island of Jersey, between England and France, didn't start using GMT until 1898)

  2. For years by Sez+Zero · · Score: 5, Funny

    and it only comes along every for years.

    Wow! That really IS rare!

    1. Re:For years by oodaloop · · Score: 2

      The slashdot editors were probably just reading an alien cookbook and got confused.

      --
      Tic-Tac-Toe, Global Thermonuclear War, and relationships all have the same winning move.
    2. Re:For years by Anonymous Coward · · Score: 2, Funny

      That must be the American spelling: there's no "u".

    3. Re:For years by Smallpond · · Score: 2

      "The Bad Astronomer writes"

      Nope. Probably not a math wiz, either.

    4. Re:For years by neokushan · · Score: 2

      Slashdot's crap filter didn't help.

      --
      +1 IDisagreeSoHeMustBeATrollOrAnAstroturferOrAShill
  3. Complicated? by Anonymous Coward · · Score: 5, Insightful

    I think we have different definitions of complicated.

    1. Re:Complicated? by Meshach · · Score: 4, Funny

      I think we have different definitions of complicated.

      Evidently spelling and grammar top the list for the /. editors.

      --
      "Maybe this world is another planet's hell"
      Aldous Huxley
    2. Re:Complicated? by Anonymous Coward · · Score: 2, Interesting

      unless it's the turn of the century, cuz those aren't leap years. Unless it's every fourth turn of the century, because those ones are. Hence why 2000 was a leap year, even though according to the century rule it wasn't supposed to be one. 2100 won't be a leap year.

    3. Re:Complicated? by Anonymous Coward · · Score: 2, Insightful

      In APL I could do it in four characters without any of those wimpy spaces and other noise.

    4. Re:Complicated? by Forty+Two+Tenfold · · Score: 4, Informative

      bool leap = !(year & 3 || !(year % 100) && year/100 & 3));

      --
      Upward mobility is a slippery slope - the higher you climb the more you show your ass.
    5. Re:Complicated? by neokushan · · Score: 2

      Pre-Gregorian was the Julian Calendar which WAS just "year % 4 == 0". The 100/400 year exceptions were what the Gregorian Calendar changed.
      Unless you mean calculating a Julian date from a gregorian date....

      --
      +1 IDisagreeSoHeMustBeATrollOrAnAstroturferOrAShill
    6. Re:Complicated? by Yvan256 · · Score: 3, Funny

      Good news! Your troubles will be over soon!

    7. Re:Complicated? by snowgirl · · Score: 3, Informative

      bool leap = !(year & 3 || !(year % 100) && year/100 & 3));

      You do realize that at least on the x86 architecture that "year / 100 & 3" is two instructions, while "year % 400" will execute in the same time as "year / 100"...

      --
      WARNING! This girl exceeds the MAXIMUM SAFE standards established by the FDA for BRATTINESS
  4. Its not that hard by suso · · Score: 5, Interesting

    On climagic I laid it out in less than 140 characters.

    1. Re:Its not that hard by Anonymous Coward · · Score: 2, Funny

      ARRGH, a twitter feed I acutally want to follow.

  5. Length of year, day, etc. by AliasMarlowe · · Score: 2

    A year is not even exactly 365.2422 days long (if we could actually agree how long a "day" is).

    --
    Those who can make you believe absurdities can make you commit atrocities. - Voltaire
    1. Re:Length of year, day, etc. by WebManWalking · · Score: 2

      The 3/1000 difference from .2425 to .2422 results in a Y30K problem. After 30,000 AD, we can relax for a while.

    2. Re:Length of year, day, etc. by tompaulco · · Score: 2

      The 3/1000 difference from .2425 to .2422 results in a Y30K problem. After 30,000 AD, we can relax for a while.
      Due to tidal forces slowing the Earth's rotation, in the year 30,000, the day will be about half a second longer resulting in the year being only 365.2401 days long, so we will need to adjust our algorithms a lot sooner than that

      --
      If you are not allowed to question your government then the government has answered your question.
    3. Re:Length of year, day, etc. by mwvdlee · · Score: 2

      If the days would become shorter, that means we'd be able to drop the %400 rule somewhere between now and Y30K, but since a day is actually slightly longer than what our current algorithm accounts for, the two might just cancel eachother out to let the algorithm last well beyond 30K. I'm too lazy to try and do the math to verify.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
  6. Knowing the rules (and not just for leap day) by RyoShin · · Score: 4, Interesting

    One of my first projects in Computing and Algorithms I in college was to make a calendar that would print out in console with days correctly placed on the day of the week. The instructions specified to take special care for leap day; everyone thought they understood leap day, so no one bothered to check on the rules. The fact that round centuries do not include a leap day except when (year mod 400 = 0) meant that every one of our calendars[1] was wrong for certain years (but right for others, IIRC). And our professor docked us points as such. Back then, the entire class (along with myself) felt that we were misled or cheated, but looking back on it now that was an important lesson on project management, specifically researching requirements and checking with the interested party about how things are.

    I reckon this lesson was missed by many, which leads to the various issues we see for software on Leap Day, including Microsoft's Azure as mentioned in a recent /. article.

    [1] For the half of the class that completed the project, this 101 class was used to weed out those who couldn't actually program for crap and the EEs just needed a C to meet their requirement.

  7. Wait, what? by Jorl17 · · Score: 4, Funny
    --
    Have you heard about SoylentNews?
    1. Re:Wait, what? by pz · · Score: 2

      Today is Feb 29, a leap day, that's why it's relevant. Tomorrow, it will be far less so.

      --

      Put my fist through my alarm clock with its ding-dong death inside my ear. - The Blackjacks.
  8. A video with visualisations by Kenosti · · Score: 3, Informative

    I much prefer the explanation in this video: http://www.youtube.com/watch?feature=player_embedded&v=xX96xng7sAE

  9. Re:Our whole calendar is messed up. by dmt0 · · Score: 5, Insightful

    The whole 7 day week is rather random too- based on some out-of-date dogma that is probably mistranslated. (the original word in Genesis translated as "day" was more accurately "a period of time" although it was often "day" but not necessarily) - so we force the meaning of "day" onto it and have a 7 day week. Silly number.

    Let's make a week 10 days- a much more logical number.

    Actually 7-day week makes sense if you have a 28-day month.

  10. Re:Lets use the Myan Calendar by spidercoz · · Score: 4, Funny

    did your "Myans" invent the number "for"?

    --
    "I disapprove of what you say, but I will defend to the death your right to say it." - Evelyn Beatrice Hall, re Voltaire
  11. Four days too late! by Guppy06 · · Score: 4, Informative

    The extra, or "bissextile" day is actually inserted immediately after February 23.

    The Romans picked up the Egyptians' idea of treating a common year as 360+5 days, since 360 is a highly composite number and all (the Mayans ended up doing the same). But instead of treating the extra 5 days as "epagomenal" (outside any month), they were treated as the last five days before the first month of spring, i. e. the last five days of February.

    Treating the five-day block of Feb 24 through Feb 28 as inviolate meant inserting the extra day (previously an extra month) before it.

    This is why the Christian feast of Saint Matthias has historically been observed on February 24 in common years and February 25 in leap years; it's always the fifth ("sixth," if you lack an understanding of zero) day before the calends of March.

  12. Re:In Soviet Russia... by spidercoz · · Score: 4, Funny
    that was really forced, and you're doing it wrong

    e.g.; "In Soviet Russia, year leaps you! Ha ha ha." (there's no way to spell Yakov's laugh)

    --
    "I disapprove of what you say, but I will defend to the death your right to say it." - Evelyn Beatrice Hall, re Voltaire
  13. leap days make ood codeing bugs show up some times by Joe_Dragon · · Score: 2
  14. Who are we kidding? The real reason for leap days: by EmagGeek · · Score: 2

    To give first-time programming students a fun and interesting homework assignment.

  15. Re:Totally agree. by jc42 · · Score: 5, Interesting
    What I like to do when people seem confused about leap-year calculation is quote them the text in Pope Gregory's definition in the February 24, 1582 document "Inter Gravissimas":

    "Deinde, ne in posterum a XII kalendas aprilis aequinoctium recedat, statuimus bissextum quarto quoque anno (uti mos est) continuari debere, praeterquam in centesimis annis; qui, quamvis bissextiles antea semper fuerint, qualem etiam esse volumus annum MDC, post eum tamen qui deinceps consequentur centesimi non omnes bissextiles sint, sed in quadringentis quibusque annis primi quique tres centesimi sine bissexto transigantur, quartus vero quisque centesimus bissextilis sit, ita ut annus MDCC, MDCCC, MDCCCC bissextiles non sint. Anno vero MM, more consueto dies bissextus intercaletur, februario dies XXIX continente, idemque ordo intermittendi intercalandique bissextum diem in quadringentis quibusque annis perpetuo conservetur."

    This quote should make the algorithm clear to any competent programmer. Note that it contains the explicit example that in the year 2000, February contains 29 days.

    Of course, it can be expressed in many fewer characters in most programming languages. But the pope's astronomer didn't have any programming languages available back in 1582.

    It can be fun to point out that the above Latin passage is still the "official" definition of the leap year scheme, since no standards body has tried to revise it. As far as I've been able to determine, that is; let me know if this has ever actually happened. It'd be especially fun if some standards body had tried to rephrase this in a modern language, but got it wrong. If so, they were probably shocked to discover that a 16th-century pope's edict trumped their scientific calcuations.

    (The /. software guys might be able to block posting in Russian or Chinese or Arabic, but it's a lot harder to prevent people from using Latin. ;-)

    --
    Those who do study history are doomed to stand helplessly by while everyone else repeats it.
  16. Re:Our whole calendar is messed up. by icebike · · Score: 4, Insightful

    Exactly my point.
    Nobody's going to listen to any ideas of changing this at this point because there is no need, and a lot of pain involved.

    If you planned it for 10 years you would still have 50% of our automated infrastructure stuck on old time keepers. Bazillions of contracts, deeds, etc would need rewrite, and virtually all historical texts would need corrections.

    The only place where there is anything to gain is in date computations in computers, and we have that solved.

    Its a mess, but not a debilitating one.

    Converting to any other system would be all pain, and zero gain.

    --
    Sig Battery depleted. Reverting to safe mode.
  17. Re:Our whole calendar is messed up. by Guppy06 · · Score: 5, Informative

    Our whole calendar is messed up. First- Jan 1st is a poor start date.

    I suspect the original pioneers intended the year to start on the Winter Solstice-

    Yes, but Julius Caesar decided to start it on the first new moon following. And based on the best data available at the time, every 19th year would have started on a new moon (see below).

    which is more like Dec 21st most years on our calendar.

    More like Dec 25 at the time, hence the date of Christmas.

    So- The year should start on Dec21st.

    It took almost 2500 years for everyone to agree to start their year with January (instead of March). George Washington himself was fuzzy on what year he was born. Now, after just getting things straightened out (on a relative time scale), you want to fuck with it again?

    Then- our months are supposed to be based on cycles of the moon (Approx every 28 days)-

    29.5 days. The usual approximation is alternating months of 29 days and 30 days in length.

    but because there were 13 and superstitious nitwits didn't like 13 we have 12 months with varying days.

    13-month years work for all the cultures with a lunar calendar, e. g. the Jews and the Chinese. The biggest problem is reckoning when the 13th month gets added. If you treat the tropical year as 365 days, you have to add an extra synodic month 7 times in 19 years (Metonic cycle). If you use 365.25 days for a tropical year, it's more accurate to say that 28 are added in 76 years (Callippic cycle). And if you're using the even-more-accurate 365.2425-day approximation... well, go search for the term "epact."

    The whole 7 day week is rather random too-

    Try counting the number of days between the first visibility of the new crescent moon and first quarter. Only your eyes and your ability to estimate the illumination of the moon are allowed.

    based on some out-of-date dogma that is probably mistranslated. (the original word in Genesis translated as "day" was more accurately "a period of time" although it was often "day" but not necessarily)

    If you're referring to chapter 1, note that "day" is always paired with "night."

    Let's make a week 10 days- a much more logical number.

    Revolutionary France called, they want their "decades" back.

    Regardless, (365 mod 7) = 1 while (365 mod 10) = 5.

    So we have 36 weeks in a year. If we MUST have a bigger break- we can divide these into 9 months of 4 weeks each.

    Even Revolutionary France understood the importance of the four seasons, with agriculture being the foundation of modern civilization and all.

    We would then have 5 or 6 days at the end- a "half week"

    Coptic Egyptians want their "epagomenal days" back.

    Not perfect- but based more on logic than our current system and no-silly formulas needed (other than determining the solstice)

    And you would once again have devised a calendar system that focuses on rationalism at the expense of pragmatism and utility, using many ideas have have been tried for centuries or even millennia. Here's what you'd be abandoning:

    • 1.) It is currently trivial to determine what day of the week successive years start on.
    • 2.) All solstices and equinoxes roughly occur the same number of days before the end of their respective months.
    • 3.) Equinoxes and solstices are treated as dates rather than instants (at this instant, it's February 29 in North America and March 1 in Asia).
    • 4.) All days are allotted to a month.
    • 5.) All days are allotted to a week.
    • 6.) Intercalary days follow a simple mathematical pattern with once-in-a-lifetime exceptions.

    In fact, 2, 4 and 6 above were deliberate design choices on the part of Julius Caesar specifically to keep things simple.

  18. Re:Our whole calendar is messed up. by Rhacman · · Score: 2

    Pff, base 10 logical? I propose we cut off everyones pinky fingers and transition everything to base-8 which is a nice power of 2. We should also probably be working on speeding up the rotation of the earth so that there are 512 days in a year. Once we do all that we can have exactly; 8 months to a year, 8 weeks to a month, and 8 days to a week.

    --
    Account -> Discussions -> Disable Sigs
  19. Re:Our whole calendar is messed up. by DragonWriter · · Score: 2

    Our whole calendar is messed up. First- Jan 1st is a poor start date.

    All start dates are equally arbitrary, so Jan. 1 is as good as anything else.

    I suspect the original pioneers intended the year to start on the Winter Solstice

    No, The starting day of the year under the old Roman Republican system (from which our modern system evolved by way of the Julian and Gregorian reforms) was whatever day happened to start the Roman consular term (since years weren't numbered, they were named after the consuls in office), this moved more than once during the life of the Roman Republic and came to rest at January 1 in 153 B.C.

    The starting date stuck in most places using the Julian calendar (at least in common usage as to what was "New Years Day"; though lots of places moved the official starting date for the numbered year to some church holiday, and which holiday was chosen varied from place to place) and eventually became a universal norm.

    Then- our months are supposed to be based on cycles of the moon (Approx every 28 days)- but because there were 13 and superstitious nitwits didn't like 13 we have 12 months with varying days.

    Actually, no, the ancient Roman Calendar had ten months of 30 to 31 days, the months in it were never aligned to cycles of the moon, and there weren't 13 of them. It started on the vernal equinox (not the winter solistice, as you've suggested must be the case), and had a number of days added outside of any month at the end to make sure the next year started on a vernal equinox (and, since it only had 304 days in its 10 months, there were a bunch of those days.)

    A later reform brought it up to 12 months, all of which (except February) had an odd number of days (29 or 31) because odd numbers were considered lucky. February was addressed by splitting it into to pieces, each of which had an odd number of days (23 and 5), and whenever a leap month (the basic calendar was 354 days long) was added to align it with the equinoxes, the leap month was added after the first part of February and incorporated the last part of February.

    Our current concept of a month is meaningless. The whole 7 day week is rather random too- based on some out-of-date dogma that is probably mistranslated.

    Actually, the 7-day week makes sense as 1/4 of the 28-day lunar cycle; its quite likely that that shaped the creation story you are referring to rather than the other way around.

    Let's make a week 10 days- a much more logical number.

    Its a completely arbitrary number. Matching up with the median number of fingers a human has doesn't make it a "logical number".

    Not perfect- but based more on logic than our current system and no-silly formulas needed (other than determining the solstice)

    Actually, its based on no more logic than the worst of the older calendars -- its just pick some arbitrary numbers as a basis for the basic schedule based on criteria that have no fundamental utility except aesthetic appeal to the designer, and then when it doesn't match to its basic goal (aligning with the cycle of equinoxes) add however many days necessary outside the regular cycles to fix that

  20. Re:Our whole calendar is messed up. by JackPepper · · Score: 2

    I have been ranting about a 13 month year to my coworkers for about a year now. 12 months would have 28 days. The last month would have 29 days. Every leap year the last month would have 30 days. A lot of companies would be giving an extra day of vacation every four years.

  21. Re:Our whole calendar is messed up. by DragonWriter · · Score: 2

    Solstice is significant because it is not an arbitrary day- it is a measurable location on earth's flight. Jan 1 is just arbitrary with no scientific marker. It is very likely when the calendar were first created they intended it to be on the solstice- but human ineptitude made it drift to what is Jan 1 today.

    The oldest known version of the Roman calendar that became the calendar we have now had its start date fixed to the vernal equinox, actually.

    Jan. 1 wasn't reached by the date floating because the calendar wasn't pinned to the solar year, it was reached by Roman Republican practice of naming years after the consuls in office, which resulted in the year (for documentary purposes) starting on whatever date consular terms switched, which eventually got ended up being Jan. 1. This start date then stuck even after Roman consular terms became irrelevant.

    Its not like all this isn't well documented, perhaps you should bother to read up on what is known about a topic before trumpeting assumptions as likely-to-be-true that are based on nothing more than your speculation about dates that happen to be near each other.

  22. Re:Our whole calendar is messed up. by JazzHarper · · Score: 2

    Let's make a week 10 days- a much more logical number.

    So we have 36 weeks in a year. If we MUST have a bigger break- we can divide these into 9 months of 4 weeks each.

    The French Republic did exactly that. Their calendar had 10 days in a week, 3 weeks in a month, 12 months in a year. That calendar remained in effect for 12 years, until it was abolished by Napoleon.

    They also introduced decimal time (100 seconds in a minute, 100 minutes in an hour, 10 hours in a day).

  23. Revised Julian Calendar by uigrad_2000 · · Score: 4, Informative

    And, not everyone has changed to the Gregorian calendar yet.

    There's a few areas of European that refused to change from the Julian to the Gregorian, not because of any scientific reason, but because of a political reason. You see for quite a while, the main purpose of a complicated calendar was to keep track of when exactly Easter should be celebrated, and the different Orthodox churches quibbled about this. For a while, there was two different Easters, one for people on the Julian calendar, and one for people using the Gregorian.

    The whole world changed to Gregorian, so they had to compromise. The compromise is one of the most hilarious developments in time tracking: the Revised Julian Calendar

    Those who follow the Revised Julian Calendar never obey the "every 400 years" rule. Instead, they celebrate leap years every 4, unless the year is divisible by 100, unless the year is mod 900 is 200 or 600

    The net result is that those countries were in agreemet with us retroactively in 1600, and in 2000, but the system will fall apart in 2400. The designers then get to live knowing that their principles have not been compromised, yet it will leave the fallout of the difference to their descendants.

    --
    Free unix account: freeshell.org
  24. Re:Totally agree. by camperdave · · Score: 2

    What I like to do when people seem confused about leap-year calculation is quote them the text in Pope Gregory's definition in the February 24, 1582 document "Inter Gravissimas":

    "Deinde, ne in posterum a XII kalendas aprilis aequinoctium recedat, statuimus bissextum quarto quoque anno (uti mos est) continuari debere, praeterquam in centesimis annis; qui, quamvis bissextiles antea semper fuerint, qualem etiam esse volumus annum MDC, post eum tamen qui deinceps consequentur centesimi non omnes bissextiles sint, sed in quadringentis quibusque annis primi quique tres centesimi sine bissexto transigantur, quartus vero quisque centesimus bissextilis sit, ita ut annus MDCC, MDCCC, MDCCCC bissextiles non sint. Anno vero MM, more consueto dies bissextus intercaletur, februario dies XXIX continente, idemque ordo intermittendi intercalandique bissextum diem in quadringentis quibusque annis perpetuo conservetur."

    Yep. That cleared it right up!

    --
    When our name is on the back of your car, we're behind you all the way!
  25. Re:Our whole calendar is messed up. by camperdave · · Score: 3, Interesting

    I like the Shire Reckoning calendar better. Twelve months of 30 days, with 5 days in the middle of summer that are not assigned to any month. In leap year, there are six. Being in the middle of the summer (and being of hobbit origin), these days are used for parties and feast days.

    --
    When our name is on the back of your car, we're behind you all the way!
  26. I think you're doing it wrong by Zinho · · Score: 3, Informative

    You seem to have misunderstood the point the GP was making. If the computer internally stores the time as UTC then the stored time will always progress forward (UTC isn't affected by DST like GMT is), and behind the scenes it'll always be searchable. It's also about as future-proof as we can make it; if rules regarding leap years or calendaring in general change, you're screwed regardless of which system you're using. The DST translation should be done for display purposes only, based on the user's preferences for localization etc. Proper separation of content versus display logic should solve all of the problems you brought up. Those problems only become issues for people working with heterogeneous data sets (time stored differently in different data stores), in which case you'd expect to be writing translation routines anyways.

    --
    "Space Exploration is not endless circles in low earth orbit." -Buzz Aldrin
  27. Re:Our whole calendar is messed up. by Darinbob · · Score: 2

    We should just have star dates.

  28. Re:Lets use the Myan Calendar by snowgirl · · Score: 2

    Oh wait, it ends in 2012!

    No, it doesn't... just most of the digits turn to "0"... in fact, the remaining radial digit of the number representing the year will not be a "1" either, as in when we moved from 99 A.D. to 100 A.D. No, in fact, they were already on the 12th cycle, so the calendar already could express more years than just 2012 A.D. and we never had to add anything to their calendar system to do so...

    --
    WARNING! This girl exceeds the MAXIMUM SAFE standards established by the FDA for BRATTINESS