Live data from Hacker News

Falsehoods programmers believe about time

infiniteundo.com

181–190 of 212 posts

Re: Falsehoods programmers believe about time

#181
post #52

In the U.S. falling back to standard time from daylight saving time is rough. Those days have 25 hours - and the interval from 1:00 - 2:00 repeats (you reach 2:00 and fallback to 1:00 and repeat the interval). Makes power scheduling difficult - which 1:00 - 2:00 interval are you talking about? Also, the offsets between the timezones change. Eastern Daylight Time falls back from 2:00 to 1:00 Eastern Standard Time, whi…

During the last “fall back” event I experienced the 1 o’clock hour three times since I randomly happened to cross a time zone at exactly 2:00am…or maybe 1:00am? The worst part was I had an appointment at 02:00, somewhere where they won’t let you in if you show up too early, in the other time zone and hadn’t had to deal with daylight savings time for a good long while having lived in Arizona where they don’t deal with…

> having lived in Arizona where they don’t deal with such silliness

Oh god, I'm simultaneously delighted at the idea of not having to deal with DST and terrified of writing software that might have to keep track of whether or not the user was in Arizona during a DST transition.

Re: Falsehoods programmers believe about time

#182
post #167

Obviously nobody believes most of these falsehoods. Presumably the op means a lot of programmers create bugs that seem t imply programmers believe these falsehoods. But this one jumped out at me: "Any 24-hour period will always begin and end in the same day". It would be a lot more plausible if "always" were replaced with "never". Add 24 hours to a time, and it will (almost) always be the next day.

There are the things you say you believe, and there are the things your actions show you believe. This extends well past simple matters of time in computers. Some of my favorite things lie in the fractal fringe categories between those, such as, "the things you didn't realize you believed (by your actions) until someone pointed them out to you" and "the things you didn't realize you should believe (in any sense) unti…

Do you know if a list of those exists?

Re: Falsehoods programmers believe about time

#183
At NASA I wrote a set of Python scripts to help with planning and telemetry for a Mars mission. I had to convert a lot of time data points between UTC and a Mars timezone/clock (specific to the rover itself). There was an officially blessed tool written in Java that ran from the command line for time conversion. It was too slow to call out for each data point, so I figured it would be generally useful to port the conversion to Python.

First I dug into the Java source, which it turned out called out to a C library. I believe the C library linked out to a Fortran library. It was a lot more complicated than a simple scale and calendar - there were corrections for special and general relativity. Converting times actually required propagating orbits and estimating some non-closed-form quantities. In the end is was more work than it was worth, so we just did an approximation ("only" good to a few milliseconds - fine for our case).

So I guess item number 100 on this list should be "time is experienced the same way by all observers" and maybe 101 "simultaneity depends on the reference frame" :)

Re: Falsehoods programmers believe about time

#184
post #181

Earlier quoted context omitted.

During the last “fall back” event I experienced the 1 o’clock hour three times since I randomly happened to cross a time zone at exactly 2:00am…or maybe 1:00am? The worst part was I had an appointment at 02:00, somewhere where they won’t let you in if you show up too early, in the other time zone and hadn’t had to deal with daylight savings time for a good long while having lived in Arizona where they don’t deal with…

> having lived in Arizona where they don’t deal with such silliness Oh god, I'm simultaneously delighted at the idea of not having to deal with DST and terrified of writing software that might have to keep track of whether or not the user was in Arizona during a DST transition.

Arizona just stays on MST year long making it easy unless you have to figure out what time everyone else is on.

And for even more fun the Navajo Nation does do time zone changes.

Re: Falsehoods programmers believe about time

#185
post #180

Earlier quoted context omitted.

On the other hand we'll have a whole 13'th month, which will afford us many bonus Fridays the thirteenth.

Depends, each month has exactly 28 days. So you either never get a Friday the 13th, or you get one every four weeks.

I thought the implication was every Friday in the 13th Month is a "Friday of the 13th" which is close enough.

Re: Falsehoods programmers believe about time

#186
post #180

Earlier quoted context omitted.

Depends, each month has exactly 28 days. So you either never get a Friday the 13th, or you get one every four weeks.

I thought the implication was every Friday in the 13th Month is a "Friday of the 13th" which is close enough.

That's what I was going for

Re: Falsehoods programmers believe about time

#187

We should just define a year to be 360 days long and made up of 12 30 day months. Then we can elect some druids or whatever to arbitrarily, at the start of each year, define which dates the seasonal borders will land on. Events which are truly dependent on weather can be defined in terms of "Days after the season starts." Or we could define a 5.5+-.5 day holiday between the beginning and end of a given year. Those da…

This was more or less exactly the French republican calendar, with 10 days weeks also: https://en.m.wikipedia.org/wiki/French_Republican_calendar

Re: Falsehoods programmers believe about time

#189
post #2

Unimportant sidenote: I don't like the naming of these "falsehoods programmers believe about X" lists. Surely programmers are more likely to be conscious of these not being true than non-programmers.

No, they are not. Beyond leap years and leap seconds, I know absolutely nothing about time, how to handle all the "daylight savings" and other kind of bullshit. And I actually do not care, at all. Luckily for me, people who do care and know these things have made libraries that can handle it all while expecting only minimal knowledge from me, such as being aware that time zones exist at all.

Re: Falsehoods programmers believe about time

#190

> GMT and UTC are the same timezone. I got one for OP, too: UTC is not a timezone in the first place [1]. > UTC is not a time zone, but a time standard that is the basis for civil time and time zones worldwide. This means that no country or territory officially uses UTC as a local time. The difference is subtle, but a standard is not subject to government whims while a timezone is. 1. https://www.timeanddate.com/time…

[deleted]
Post reply on HN