Live data from Hacker News

Falsehoods programmers believe about time and time zones

creativedeletion.com

41–50 of 83 posts

Re: Falsehoods programmers believe about time and time zones

#41
post #13

In 2012, I submitted a Python bug about the bad state of ISO 8601 date parsing in Python. It's still open, after four years of arguments.[1] [1] https://bugs.python.org/issue15873

For those who perhaps don't use Python: what makes this more ridiculous is that Python can output ISO timestamps. But it cannot read them back in. Thankfully, there are third party libraries that do just this (such as iso8601), but its such a silly dependency to need.

Yes, there are at least six such libraries, and most, if not all, of them have bugs. Different bugs.

Re: Falsehoods programmers believe about time and time zones

#43

I hope http://momentjs.com/ is not one of libraries that falls into "Many people write libraries without knowing much about the domain." I have used it many times and it is the best one I have come across. Timezones conversion is super hard, which is the exact reason I rely on libraries rather than trying to reinvent the wheel.

Saw the title and came here to write about moment. I work on a large code base that had considerable amounts of code related to time conversions in numerous different places, each handled differently with different bugs, and I've slowly been moving things towards just using moment. It's been a huge time saver and has fixed issues everywhere I've ended up using. Probably one of the most useful libraries around for sure!

Re: Falsehoods programmers believe about time and time zones

#44
post #41

Earlier quoted context omitted.

For those who perhaps don't use Python: what makes this more ridiculous is that Python can output ISO timestamps. But it cannot read them back in. Thankfully, there are third party libraries that do just this (such as iso8601), but its such a silly dependency to need.

Yes, there are at least six such libraries, and most, if not all, of them have bugs. Different bugs.

Simple, use em all, and make a majority decision :P

Re: Falsehoods programmers believe about time and time zones

#46
post #31

Earlier quoted context omitted.

> It bothers me that a minute is not always 60 seconds. For leap seconds why did we choose 23:59:60 instead of 24:00:00? But how does this solve the problem? Sure, 23:59 is now 60 seconds long, but the minute 24:00 is only 1 second long.

It's about consistency. 23:59:60 is introducing a special case to the seconds field which you have to account for. 24:00:00 only adds a second to the day where it naturally should go. I don't redefine what a minute is, a minute is always 60 seconds. You are confusing two separate ideas, displaying a time and finding the difference between two times. Lexically you wouldn't say that minute is 1 second long, you would s…

But then you have a second that doesn't belong to a minute.

Re: Falsehoods programmers believe about time and time zones

#47
post #27

Would it be too much to have a global movement for uniform time standards? No half-hour timezones, no daylight savings, no leap seconds, just easily predictable time. Calendars are supposed to be convenient, and right now our ancient conventions make it difficult to understand each other (not just computers; think of travelers having to adjust to timezones, "do I need DST or not?"). At least, lets think of the electr…

You may be interested in the following articles:

"So you want to abolish time zones" https://qntm.org/abolish

>We already do have a global standard time zone, and everybody who cares already uses it: UTC. There are also more accurate time standards in use for more specialist purposes.

"You advocate a ________ approach to calendar reform" https://qntm.org/calendar

These links helped convince me that while time zones and calendar systems are very messy, there are some inherent reasons why they are messy.

Re: Falsehoods programmers believe about time and time zones

#48

One of the more interesting bugs I've created is in an Elixir program using the (great) Timex[0] library. I realised that for a few particular users, timezones were being inverted when converted (e.g. a user in GMT+5 would behave as if they were in GMT-5 and vice versa). After a lot of time spent proving to myself I was not actually going mad, I opened a Github issue and the library author informed me about one of th…

Hi. I'm the author of the article. And also of Elixir Tzdata and https://github.com/lau/calendar I recommend using Calendar instead of Timex.

I'm curious: Why where you using e.g. GMT+5 or GMT-5?

Re: Falsehoods programmers believe about time and time zones

#49

Dealing with timezones and daylight savings time has consumed hundreds of hours of my development time. This seriously should be a standard service of the operating system, not the programming language library. Just look at all the code to deal with it in D (written by Jonathan Davis): https://github.com/dlang/phobos/blob/master/std/datetime.d

Operating systems kind of suck at it. Which is why for Elixir I made Tzdata (https://github.com/lau/tzdata) not rely on any timezone information from the operating systems. A feature I would like from operating systems is to tell me the true time during leap seconds. E.g. 23:59:59, 23:59:60, 00:00:00 Instead of repeating 23:59:59 or just pretending the leap second never happens.

Re: Falsehoods programmers believe about time and time zones

#50

My bete noir isn't in the list: GMT is only the UK timezone for about half the year. During the Summer, GMT continues to exist, but the UK time is BST.

You are right. I have heard that one before too. That one is sort of implicitly covered by this part in the blog post:

"CST is also used for: Cuba Summer Time, China Time, Central Standard Time (Australia). PST is used for Pakistan Standard Time and Pacific Standard Time. If you want a unique identifier for the time zone in the Pacific West of the USA it looks like this: “America/Los_Angeles”."

In this case the name of the time zone "people live in" is "Europe/London", not GMT.

Post reply on HN