• Matt Westwood (unregistered) in reply to Dave

[quote user="Dave"][quote user="frits"]This makes me wonder why the Euros are all pushing for a metric calendar. I mean the Leap Year problem is a pretty good example why the Gregorian Calendar should be considered harmful.[/quote]

We must change the calendar because of stupid people. There's a new one... [quote]"Stupid people" is a redundant term fuckwit.

• AN AWESOME CODER (unregistered) in reply to Therac-25
Therac-25:
frits:
This makes me wonder why the Euros are all pushing for a metric calendar. I mean the Leap Year problem is a pretty good example why the Gregorian Calendar should be considered harmful.

What other solutions are there for the problem? i.e. the rotation of the earth is not in perfect sync with it's orbit, so you can't create a measurement of the orbit that is perfectly factored by a measurement of it's rotation.

There are less complex ways to solve that problem though:

http://en.wikipedia.org/wiki/International_Fixed_Calendar

In other-words, having less exceptions to consider means less inaccuracies.

• (cs) in reply to frits
frits:
This makes me wonder why the Euros are all pushing for a metric calendar. I mean the Leap Year problem is a pretty good example why the Gregorian Calendar should be considered harmful.
Are we fuck. Who told you that shit?
• (cs) in reply to boog
boog:
frits:
boog:
...my client is an alcohol company, and I run their website. They have a members-only section of their site that requires that you to enter your birthdate.
Why? Is there porn there?
No, but there is violence. It's an alcohol company after all.
Violence is fine, as long as there are no curse words.

Well this site's fucked like a cunt to buggery then, innit?

• maciel310 (unregistered)

Hilarious note: after reading this, I over hear the head of the department who runs our client's alcohol site had the exact same issue today. Wonder how many others are out there...

• no (unregistered) in reply to Mason Wheeler
Mason Wheeler:
szeryf:
“There are only two hard things in Computer Science: cache invalidation, naming things, and handling of the 29th of February."
...and off-by-one errors.
FTFY
• (cs)

Well, it's a bit off subject, but here's a reproduced version of part of a validation routine I once saw:

```valid = true;

if ( day < 1 || day > 31 )
{
valid = false;
}
else if ( day == 31 )
{
if (month == 2) valid = false;
if (month == 4) valid = false;
if (month == 6) valid = false;
if (month == 9) valid = false;
}
else if ( day == 29 )
{
if ( year % 4   != 0) valid = false;
if ( year % 100 == 0)
{
if ( year % 400 != 0) valid = false;
}
}
```

February 30, anyone? (Well, it almost worked.)

Addendum (2012-02-29 13:13): Forgot November in the first list. Oh, well; I was just trying to give you the flavor.

• Tonsil (unregistered) in reply to PiisAWheeL
PiisAWheeL:
Who cares what you call it. Language tends to evolve to use shorter words anyways. You could call it a hoogawoogabooga and it would adventually get shortened to a wuga anyways.

On this side of the Appalachians, we call them "hugas".

• (cs) in reply to Tonsil

We should use a lunar based calendar.

• (cs) in reply to Coyne
Coyne:
Well, it's a bit off subject, but here's a reproduced version of part of a validation routine I once saw:
```valid = true;

if ( day < 1 || day > 31 )
{
valid = false;
}
else if ( day == 31 )
{
if (month == 2) valid = false;
if (month == 4) valid = false;
if (month == 6) valid = false;
if (month == 9) valid = false;
}
else if ( day == 29 )
{
if ( year % 4   != 0) valid = false;
if ( year % 100 == 0)
{
if ( year % 400 != 0) valid = false;
}
}
```

February 30, anyone? (Well, it almost worked.)

It will also fail if fed November 31st. Whoever wrote that needs to be tarred and feathered.
• Rnd( (unregistered)

"string LegalYear = (intMon + "/" + intDay + "/" + intYear);"

TWTF is the date format too!

I just had to say that one...

• (cs)

I looked at the date on my (digital) wristwatch this morning, and noticed it said it was the 1st of March. Pressing the Adjust button, I discovered that setting back the date by one day put it on 29 February — which, of course, it had skipped past at 00:00 this morning.

Now, on the couple of previous digital wristwatches by this same manufacturer I've owned, you could set the year and the watch handled leap years automatically and correctly. (Those watches had the problem that their date couldn't go past 2000 and 2020, IIRC.) I can't really work out what the designers were thinking here … let's save memory by not storing the year, but then let's add a check to see if the user is turning the date back from 1 March so it can go to 29 February … WTF?

• Mark (unregistered) in reply to Sobi
Sobi:
Why should a year be the revolution time of the earth ?

Much to their dismay, ancient peoples didn't own SUVs that they could use to drive to 24/7 grocery stores. Their primitive workaround was to invent a Calendar, which helped them predict whether it was time to plant or harvest crops. :)

• Anonymous (unregistered)

silly ancients, they could have just written a routine like this to decide for them:

If crops exist harvest crops else plant crops

• (cs) in reply to Gurth
Gurth:
I looked at the date on my (digital) wristwatch this morning, and noticed it said it was the 1st of March. Pressing the Adjust button, I discovered that setting back the date by one day put it on 29 February — which, of course, it had skipped past at 00:00 this morning.

Now, on the couple of previous digital wristwatches by this same manufacturer I've owned, you could set the year and the watch handled leap years automatically and correctly. (Those watches had the problem that their date couldn't go past 2000 and 2020, IIRC.) I can't really work out what the designers were thinking here … let's save memory by not storing the year, but then let's add a check to see if the user is turning the date back from 1 March so it can go to 29 February … WTF?

Set a reminder for yourself now, so you don't forget. On 2013-03-01, set your watch back a day. I'm curious to see whether it goes back to the 28th or 29th.

• (cs) in reply to Anonymous
Anonymous:
silly ancients, they could have just written a routine like this to decide for them:

If crops exist harvest crops else plant crops

You would have been sacrificed to help the crops grow after that advice failed.

• (cs) in reply to Matt Westwood
Matt Westwood:
boog:
frits:
boog:
...site that requires that you to enter your birthdate.
Why? Is there porn there?
No, but there is violence.
Violence is fine, as long as there are no curse words.
Well this site's fucked like a cunt to buggery then, innit?
Indeed. Alex really needs to add age restrictions to this site.

Won't somebody please think of the children?

• big picture thinker (unregistered)

A little thing called Unix Timestamps could help here.

• (cs) in reply to Mason Wheeler
Mason Wheeler:
szeryf:
“There are only three hard things in Computer Science: cache invalidation, naming things, and handling of the 29th of February."
...and off-by-one errors.
Still three hard things.
• Albert (unregistered) in reply to Carl
Carl:
Now that we are on the verge of becoming a spacefaring civilization, it is long past time to discard our backwater planet-centric timekeeping system in favor of something Universal.

I propose a simple floating point counter of seconds since the big bang. Should work anywhere, forever. Leap second, leap year, Y2K, December 2012... who cares? Just keep incrementing that counter!

What about relativistic effects? China launches a ship to Tau Ceti at 0.80 c, US freaks out and launches theirs later at 0.90 c. From Tau Ceti vantage point, they both get there at the same time, but time elapsed is different for both. Correcting for velocity depends on which frame of reference to adopt: e.g. motion of earth around sun, sun through galaxy, galaxy in local group, or against the CMBR.

• Gecko (unregistered) in reply to Rick
Rick:
Mason Wheeler:
szeryf:
“There are only three hard things in Computer Science: cache invalidation, naming things, and handling of the 29th of February."
...and off-by-one errors.
Still three hard things.
That's what she said.
• Dilbert Wannabe (unregistered)

It never ceases to amaze me -- and make me sick to my stomach -- that so many developers always try to do things using Strings rather than using classes designed to handle specific domain rules. Dates, Files/Directories and URLs are probably the three biggest offending cases that come to mind.

Too often I see code such as the case I saw where a developer has a File object, converts it to a string, dances through a couple dozen if statements with a fair number of subString and indexof calls to put an additional directory into the middle of the path, then converts the String back to a File object. And he likely only converted back to the File object because that is what the method he wanted to call required. ugh.

• (cs) in reply to Gecko
Gecko:
Rick:
Mason Wheeler:
szeryf:
“There are only three hard things in Computer Science: cache invalidation, naming things, and handling of the 29th of February."
...and off-by-one errors.
Still three hard things.
That's what she said.
You are 2 weeks late. http://voices.yahoo.com/international-thats-she-said-day-set-february-192973.html
• lazloman (unregistered)

Laziness solves problems like this.

• (cs)

On a related note... The length of a year is natural. The length of a month is almost natural. Why seven days for a week? Purely biblical? One of the few factors of 28?

• Dan (unregistered) in reply to Mason Wheeler
Mason Wheeler:
szeryf:
“There are only three hard things in Computer Science: cache invalidation, naming things, and handling of the 29th of February."
...and off-by-one errors.
...and having utterly useless colleagues.
• (cs) in reply to big picture thinker
big picture thinker:
A little thing called Unix Timestamps could help here.
lazloman:
Laziness solves problems like this.
I take it you sir have no need for a calendar. 1 day at a time. Never needing to plan more than 3 hours into the future. I used to be like that. I envy that...
• Pudley J. Wormbottom (unregistered) in reply to Gurth

Hmmmm.. My Analog wristwatch handled id perfectly

• Zunesis, In the Flesh! (Your mom's!) (unregistered) in reply to boog
boog:
Matt Westwood:
boog:
frits:
boog:
...site that requires that you to enter your birthdate.
Why? Is there porn there?
No, but there is violence.
Violence is fine, as long as there are no curse words.
Well this site's fucked like a cunt to buggery then, innit?
Indeed. Alex really needs to add age restrictions to this site.

Won't somebody please think of the children?

I think of children all the time. Running over cats in my car... Rubbing myself in the shower... Taking a dump...

• Gunslinger (unregistered) in reply to boog
boog:
...my client is an alcohol company, and I run their website. They have a members-only section of their site that requires that you to enter your birthdate.
Why? Is there porn there?

Because of stupid government regulations.

• Gunslinger (unregistered) in reply to Rick
Rick:
PiisAWheeL:
Bernard Kerckenaere:
That depends on the number of leapyears there's in those past 21 years.

I think I calculated for it. 21365.25246060*1000=662709600000

And your code will be long gone in 88 years when this fails.

How is that a bad thing?

• geoffrey, MCP, PMP (unregistered)

Big deal. So the site doesn't work one day every four years. There are more important things to deal with in any enterprise.

• (cs) in reply to geoffrey, MCP, PMP
geoffrey:
Big deal. So the site doesn't work one day every four years. There are more important things to deal with in any enterprise.
TRY HARDER.
• Carl (unregistered) in reply to Albert
Albert:
Carl:
Now that we are on the verge of becoming a spacefaring civilization, it is long past time to discard our backwater planet-centric timekeeping system in favor of something Universal.

I propose a simple floating point counter of seconds since the big bang. Should work anywhere, forever. Leap second, leap year, Y2K, December 2012... who cares? Just keep incrementing that counter!

What about relativistic effects? China launches a ship to Tau Ceti at 0.80 c, US freaks out and launches theirs later at 0.90 c. From Tau Ceti vantage point, they both get there at the same time, but time elapsed is different for both. Correcting for velocity depends on which frame of reference to adopt: e.g. motion of earth around sun, sun through galaxy, galaxy in local group, or against the CMBR.

Simple enough. Upon arriving at any planet, the stewardess will announce "Welcome to Sbadiuoeiwhfii where the local time is blah blah..." just like they do now.

That solution, while not ideal, will shamble along until the Galactic Internet gets up and running, at which point time sync issues will arise in the ntp protocol.

Shortly after that finally gets sorted out, one species will discover that another species worships The Force (or whatever) on Thursday instead of Wednesday, and they will be obliged to annihilate each other.

Rinse and repeat. Eventually there will only be One True Time galaxy-wide.

• david (unregistered) in reply to Gurth

Must be a Timex...mine did the exact same thing today.

• (cs) in reply to geoffrey, MCP, PMP
geoffrey:
Big deal. So the site doesn't work one day every four years. There are more important things to deal with in any enterprise.

Try explaining that to your CEO.

• Joe (unregistered)

The correct solution to the leap second problem is not to make the calendar more complicated.

"Divide by 4 unless 100 except unless 400, but we still need an exception every 3300 years or so"? Feh.

Why not simply adjust the Earth's orbit inward slightly so that it completes an orbit in exactly 365.0000 days?

Well, that would cause greater solar radiation which would result in global warming (darn you, Al Gore, for inventing that). So we'd be better off pushing the orbit outward slightly so that we'd always have a February 29. This also brings the length of a year to a nicely factorable 61x6 days, meaning we'd just have to change to a 6-day week.

The lunar cycle would have to be adjusted so that it's still a 4-week period, but that'll make the moon closer so it's easier to mine, anyway.

obCaptcha: rm -rf /sbin/init && halt && HAND

--Joe

• steve (unregistered) in reply to Coyne

fails any 29th thats not february & a leap year

• (cs) in reply to Joe
Joe:
The correct solution to the leap second problem is not to make the calendar more complicated.

"Divide by 4 unless 100 except unless 400, but we still need an exception every 3300 years or so"? Feh.

Why not simply adjust the Earth's orbit inward slightly so that it completes an orbit in exactly 365.0000 days?

Well, that would cause greater solar radiation which would result in global warming (darn you, Al Gore, for inventing that). So we'd be better off pushing the orbit outward slightly so that we'd always have a February 29. This also brings the length of a year to a nicely factorable 61x6 days, meaning we'd just have to change to a 6-day week.

The lunar cycle would have to be adjusted so that it's still a 4-week period, but that'll make the moon closer so it's easier to mine, anyway.

obCaptcha: rm -rf /sbin/init && halt && HAND

--Joe

I think we should switch to the Jalaali calendar, the most accurate calendar known to man: http://en.wikipedia.org/wiki/Iranian_calendar#Seasonal_error

This calendar will be off by one day after 3.8 million years.

• (cs) in reply to Joe
Joe:
The correct solution to the leap second problem is not to make the calendar more complicated.

"Divide by 4 unless 100 except unless 400, but we still need an exception every 3300 years or so"? Feh.

Why not simply adjust the Earth's orbit inward slightly so that it completes an orbit in exactly 365.0000 days?

Well, that would cause greater solar radiation which would result in global warming.

No. That distance change would not, for all practical purposes, affect temperature.

• (cs) in reply to Rick
Rick:
On a related note... The length of a year is natural. The length of a month is almost natural. Why seven days for a week? Purely biblical? One of the few factors of 28?
The principal lunar phase changes (new-->first quarter, first quarter-->full, etc.) are very close to seven days long.
• jdmeth (unregistered)

Today is Stardate 65629.1

• Simon (unregistered) in reply to Joe
Joe:
Why not simply adjust the Earth's orbit inward slightly so that it completes an orbit in exactly 365.0000 days?

If you're going to do that, can I suggest going with the slightly more readily divisible 360 days? And adjusting the lunar orbit appropriately so months can all be of equal length?

• Rnd( (unregistered)

If we go on adjusting the lenght of year why not go to something sensible like 100 or 1000 days. Or fix days to this period. So either slow down earth's rotation or speed it up. Then we could at same time move time in 10base system. WIN WIN WIN WIN! I don't belive it would take more than a million years if even that for evolution to fix things which isn't much considering the lifespan of solar-system left...

• MarkT (unregistered) in reply to Mason Wheeler
Mason Wheeler:
szeryf:
“There are only three hard things in Computer Science: cache invalidation, naming things, and handling of the 29th of February."
...and off-by-one errors.

Four things. The four things are cache invalidation, naming thi..... I'll come in again.

• Roger (unregistered) in reply to Gurth

I guess your watch is a Breitling because mine did the same.

• Franco (unregistered) in reply to Simon
Simon:
Joe:
Why not simply adjust the Earth's orbit inward slightly so that it completes an orbit in exactly 365.0000 days?

If you're going to do that, can I suggest going with the slightly more readily divisible 360 days? And adjusting the lunar orbit appropriately so months can all be of equal length?

The easiest way is to change the speed of the rotation, and not translation, of earth. Perhaps if 6000mi people would run west bound at the same time, we can do it without too much tech!

• Cheong (unregistered) in reply to PiisAWheeL
PiisAWheeL:
Bernard Kerckenaere:
That depends on the number of leapyears there's in those past 21 years.

I think I calculated for it. 21365.25246060*1000=662709600000

I think it's 365.22 instead of 365.25. That's why we don't have leap year on yesrs divisible by 400.

• ¯\(°_o)/¯ I DUNNO LOL (unregistered) in reply to Gurth
Gurth:
Now, on the couple of previous digital wristwatches by this same manufacturer I've owned, you could set the year and the watch handled leap years automatically and correctly. (Those watches had the problem that their date couldn't go past 2000 and 2020, IIRC.) I can't really work out what the designers were thinking here … let's save memory by not storing the year, but then let's add a check to see if the user is turning the date back from 1 March so it can go to 29 February … WTF?
I have a telephone answering machine that wants to know the time of day, the day of the week... and the year. WTF? What the hell are you going to do with the year when you don't even know the month or the day of the month?
• Anonymous (unregistered) in reply to Mason Wheeler

At least off-by-one errors are reproducible all-year-round.