Hacker News new | past | comments | ask | show | jobs | submit login
How 1927-12-31 23:54:08 happened twice (stackoverflow.com)
152 points by martin_ on April 12, 2013 | hide | past | favorite | 57 comments



This reminds me, if you're near a *nix termial, go and type:

    cal 9 1752
(dont worry `cal` just shows you a calendar).

You can also use this to troll developers that are doing anything that has a calendar.


Heh, interesting. Thanks for the nugget!

>The Gregorian reformation was adopted by the Kingdom of Great Britain, including its possessions in North America (later to become eastern USA), in September 1752. As a result the September 1752 cal shows the adjusted days missing. This month was the official (British) adoption of the Gregorian calendar from the previously used Julian calendar. This has been documented in the man pages for Sun Solaris as follows. "An unusual calendar is printed for September 1752. That is the month when 11 days were skipped to make up for lack of leap year adjustments." The Plan 9 from Bell Labs manual states: "Try cal sep 1752." [0]

[0] http://en.wikipedia.org/w/index.php?title=Cal_(Unix)#Feature...


Some Orthodox Christians still use the Julian calendar, if only symbolically, so Christmas falls on January 7th and New Years on January 14th (Easter is a much different story: http://christianity.about.com/od/faqhelpdesk/qt/whyeastercha...). In theory, these dates should move farther and farther apart than just two weeks from the Gregorian calendar because the Julian calendar doesn't count leap years the same way.

For us Julian calendar folks, there's upsides and downsides. We get to celebrate Christmas late, but my kid will celebrate both (since my wife is of a different religion). And of course, Easter falls on Cinco de Mayo this year (but we had remember to buy enough egg coloring well in advance)! :)


I wonder if it deals with Sweden properly if you're there.

cal 2 1712

should show February 30th...

http://en.wikipedia.org/wiki/February_30#Swedish_calendar


I'm not in Sweden but changing the locale to sweden doesn't show Feb 30: LC_ALL=sv_SE.UTF-8 cal 2 1712


+1 for showing me *nix terminals have a simple calendar command. Awesome.


Wow, what a coincidence that someone curiously hit precisely the timestamp of this, and knew to use a site where question and answer would be rewarded with attention and votes.

(I am coming around to a suspicion that a lot of "wow, that's cool"-type SO questions/answers are more or less fabricated to show off something the person knows, rather than genuine knowledge-seeking, in case you can't tell)


Jon Skeet (the person that answered the question) works for Google, has more than one blog, and rep caps on stackoverflow daily from old answers because he's answered so many questions there. He's written multiple books on Java and C#. He's plenty visible. Not to mention that the question is over two years old.

There's no conspiracy here.


Plus, if you look at the guy who asked the question, he's a programmer from China, so it's not hard to imagine that had something to do with the fact that these dates popped up in development.


It's considered perfectly legitimate on SO to ask and answer your own question, so there would be no need to use seperate accounts.

I can imagine that a question like this could arise as a narrowed-down test case for a bug found in production.


There's even a feature where you can post the question and the answer at the same time now I believe!


Over the years I've evolved the strategy of asking very specific questions like that on forums. Precise code snippets seem to get precise answers. Broader code with the same problem attract many times more answers, but they are almost all junk.

When I stumble on some unusual behavior I pare it down to the simplest case possible, then ask about that problem. If I don't, the top several answers will invariably be "Why are you writing in X?! Y is so much better for this" and critiquing other parts of the code that aren't causing the odd behavior.


Or, if you really like acronyms: SSCCE http://sscce.org/

Short, Self Contained, Correct (Compilable), Example

This applies to answers on SO/lists/forums/etc, as well as questions. Everyone benefits from clear communication and examples.


Maybe, but why not let it go or even reward it? I find that it often does bring specialized information. If this person had waited for someone to ask the question, it could have remained unanswered. While now, the information is out if anyone needs it.

In short, I find this kind of fabricated Q/A an acceptable workaround the "burden" of the highly specialized knowledge bearer who would like to share it and get rewarded.


Possibly, but OTOH, when you actually have a problem where the dates are off, it's pretty easy to use binary searching to narrow the range down. The hard part is figure out why the error range causes an error.

Not to mention this question requires someone to be in the Chinese locale, and the asker is actually Chinese.


Any two timestamps which surround this point in time will show the same discrepancy, when evaluated in this time zone. He could have started off comparing 2013 and 1822 for all we know.


If you're working with historical time-series data you could easily be doing millions of time comparisons. so it's almost inevitable that people are going to hit edge cases like this.


You're right, especially considering he wrote noda time, the .NET port of joda time.


You're right, and it's actively encouraged by the site.


Alternatively, there are many times when I've started writing an SO question and came to the answer during the course of writing it (using SO as a rubber duck). I don't find it odd that I would ask it, answer it myself, and post it anyway if it's something odd like this.


This is really not a corner case. Think about it. Every place with daylight saving time will experience a duplicate hour when switching from summer time to winter time. A timestamp given in local time can map to multiple UTC times.


Except you can remove the ambiguity by stating either PDT or PST. You don't have that option in 1927 Shanghai.


Note that strftime does not produce unambiguous time zone names. The four-letter Australian time zones are printed with names such as EST and CST. Better use -0500, +0545 and the likes, as suggested by ISO 8601.


If you want to indicate a time zone you shouldn't just use the offsets - they're ambiguous in that several different time zones can have the same offset at any point in time.

Better (IMO) to use the zoneinfo ID, e.g. "Europe/London" - along with the offset as well, in case the local time is ambiguous in that time zone due to a daylight saving transition.


Would a better system for our society be to just have a universal time? Like, what if everyone in the whole world just set their clocks to UTC+0:00, and never ever changed it. They would just plan everything relative to that. I might work from 9-5 in one place, but in another someone would work from 3pm-11pm (still during daylight hours). That is to say, why do we try to synchronize our numbers with the sunlight? Is it that important that every culture gets to say that 12pm is midday?

It does seem weird that it may be customary to eat lunch at 12pm in one place, but have it normal to eat lunch at 4:30am in another. But is it any weirder than having arbitrary discrete jumps in time based on geography and time-of-year?


No, that would not be a better system.

You are just pushing the complexity somewhere else. It might make computer programming a bit easier, but everything else would be harder.

And people still sleep at night, so you would still need to know when they are awake, when they work.


It wouldn't be easier just for computing. If I need to coordinate stuff with someone in a different time zone, it'd be much easier to be able to just say "Let's have a call at 4pm," instead of figuring out what his timezone is. I guess you'd still have to know if 4pm is a good time for him though. So he'd have to have some sort of indicator of what the waking/working hours are in his region... some sort of time zone. Nevermind, the more I think about it the more I realize that timezones are pretty reasonable.


LOL, I was about to reply exactly that, then you answered your own question.


> You are just pushing the complexity somewhere else. It might make computer programming a bit easier, but everything else would be harder.

It would make communicating times easier and less prone to confusion.

> And people still sleep at night, so you would still need to know when they are awake, when they work.

Right, you would need to know when the particular people you are dealing with would be available, but when communicating times to coordinate an event, the numbers used would have the same meaning. I don't see where any complexity is being added to compensate for that that is being lost.


> I don't see where any complexity is being added to compensate for that that is being lost.

You are focusing on only a single usage of a clock: To coordinate time to speak.

Clocks are used for much more than that, for example: Our store hours are 9-5 days, well no, 9-5 in this city, but in that city it's 8:30-4:30, and so on and so on.

Every place you go you'll have to find out the local time when stores close, or when a tv show is on. Of course you could setup regional borders where all the cities in that area close at the same time.

Maybe we'll call it zones instead of areas - I know! Call it time zones!

Or laws like: Checks must be cashed if received before 4PM that day. Except now you'll have to create a system to be able to say, no, it's 4PM in this city, but in that city it's 3PM.

Congratulations: You've just invented time zones.


> Every place you go you'll have to find out the local time when stores close, or when a tv show is on.

You actually have to find that out for specific stores even with local time, and TV showtimes actually vary by location now (sometimes because they shown at constant universal time, sometimes because they are shown at region-specific time that doesn't happen to equate to a constant either in local or universal time), so neither of those is an additional cost.


Sure, but you can make a reasonable assumption that they're open in between certain hours of the day. I can make a reasonable assumption and say stores are open 11am-4pm everywhere, and I'd be right more times than not.

With a universal time, you'd need to keep track of what "11am-4pm" translates to in your local area and determine it that way.


Swatch had a time system like that for a while:

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

1000 beats in a day, 0 is midnight at UTC+1 but it doesn't adjust for time zones. It never took off and I think they scrapped it but it would be useful for coordinating between time zones. I'm sure people would fairly quickly adjust to it for their longitude but it'd be very confusing when you were travelling.


This is what China does. All time there is specified as UTC +08:00.

I studied abroad in Beijing--the time felt "normal" there as the sun would rise around 7 AM and set around 5 PM in the winter. When visiting Lhasa, those times were shifted to 8:30 AM and 7 PM. It felt somewhat disorienting.


for a longer, funnier, and mind-blowing explanation from Jon Skeet about time: http://msmvps.com/blogs/jon_skeet/archive/2009/11/02/omg-pon...


Are there any timezones left in the world that do not use whole hours?


Oh there are plenty of time zones which aren't "on the hour". But most of them either don't observe DST or are unimaginitive about it.

I was far more impressed by Nepal's proposal (later dropped, I believe) to have a 1:15 daylight saving transition:

http://www.timeanddate.com/news/time/nepal-daylight-saving-t...


Oh, the big one: The entire country of India, with all its 1.2 Billion people, is on +5:30


Central Australian time comes to mind - GMT+9.5 hrs ... Adelaide, Darwin, Alice springs.



Interestly quite a few use 30min and three use 45min, but none uses 15min.

I wonder why...


Might be revealing a profound misunderstanding, but isn't that just because of the reference point? If UTC+0 were the The Chatham Islands, then a few would.


And then there would be a gap at 45. The point is that only three of the four quadrants are occupied.


Yeah that isn't covered by what I said. I wonder if it relates to convenience. Having the same time as your neighbour is probably more handy than having a day that is off by 15 in my opinion, even off by 30 wouldn't bother me much. There must be countries that have muddled through this scenario. But it still leaves a question as to why only certain time points are chosen and others avoided.


It has been pointed out that there are many, but no one has explicitly mentioned Newfoundland (UTC−03:30). That has always been the most familiar to me as when I was growing up, television programs would always be advertised with a time such as "9:00pm (9:30 in Newfoundland)."


Not to mention a couple of times an hour while listening to CBC Radio "It's now 9:12, or 18 to the hour in Newfoundland."


Chatham Islands, east of New Zealand, are GMT+12:45.


Many, some use half hours, and there are three that use 45 minutes.


India uses UTC +5:30


Just one of Skeets masterpieces!


The second I read the title and noticed it was a Stack Overflow question, I knew that there would be an answer from Jon Skeet.

I'm not usually prone to hero worship, but I've got a lot of time for him. His book C# in Depth is absolutely fantastic, he's helped me (and probably many others on here) with questions on SO, and he comes across as such a nice guy.


There is a really great Scott Hanselman podcast where he invited Jon Skeet on to chat at CodeMash. Fascinating insight into how the guy ticks: http://www.hanselminutes.com/302/being-a-phony-with-jon-skee...


I only tick in .NET.

In Java I millisecond instead.


Haha! Good to see you here Jon! I went to reading festival last year, was hoping I'd bump into you actually... Nevermind ;)


Wooah. I used to live in Reading. Small world.


http://www.panic.com/blog/2009/12/on-calendars/

Another interesting post about the weirdness of calendars.


Odd, I would think most HNers have already heard of the top voted Jon Skeet answer. This is really old. Discussion is always great though, can't question that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: