11 ms·
'Falsehoods programmers believe about time: - Every day has a sunrise and a sunset'
by gberger 7y ago
'Falsehoods programmers believe about time:
- Every day has a sunrise and a sunset'
- rosser 7y agoRight? I am reliably put into this weird emotional state of being simultaneously entertained and chagrined at the propensity for technologists (and I very much include myself in this criticism) to make these kinds of assumptions, and the edge-case bugs that fall out of them.
- danaliv 7y agoAnd it's a reminder that "edge case" is relative. It's not an edge case for people who live there!
- gubbrora 7y agoIf we tried to get these thing 100% right we'd not have time for anything else. Punting is pragmatic.
- rosser 7y agoYou're absolutely right that "100% right" is an unreasonable standard. I submit that knowing that there are places on the planet where, at times, the sun doesn't set, however, is a reasonable thing to expect of someone who's made it far enough in life to be writing code (or testing it! How did this pass QA?) for Apple. f.lux gets it right if I set my zip to Barrow, AK. Why can't Apple, with how many orders of magnitude more resources at their disposal — including knowledge?
- gubbrora 7y agoAgreed
- vortico 7y agoIt exists, it's just complex-valued.
- ummwhat 7y agoTrue that (Posted at (5+4i):(37+5.23812i) AM)
- inlined 7y agoWhere does j & k fit into your quaternion representation?
- simongr3dal 7y agoThere are both coordinates and rotations, it would probably be better modeled as a quarternion or something of an even higher order.
- vortico 7y agoI believe you can actually compute the sunrise time of a location/day that doesn't have a sunrise, and it would be just a complex number (root of some analytic function).
- stcredzero 7y agoFalsehoods programmers believe about time: The fundamental one is: "I'm so very clever, and I've dealt with dates my whole conscious life, I can probably think of all of the edge cases off the top of my head!"
- ergothus 7y agoI think you're right, but that the tone I read in your words would prevent people from improving. Rather than "I'm so clever" it is more "this isn't complicated". One can argue they mean the same thing, but I'd say they mean different things if comparing to an outside scale. The solution to thinking you're so clever is to reduce your arrogance, but the solution to thinking problems are simple is to stop assuming any problem is simple.
- inlined 7y agoMy favorite incorrect fact is that there are 24 timezones. In fact, the number of offsets from UTC fluctuates throughout the year (at least last I worked on scheduling in 2012. Back then it was either 39 or 40 depending on DST)
- adrianmonk 7y agoThat becomes fairly obvious when you consider Arizona doesn't observe DST, but Utah is the same longitude (lies directly north) and does observe DST.
- filoleg 7y agoYep. And there also small regions that observe daylights savings WITHIN regions that don’t observe daylight savings WITHIn regions that do observe it. For example, in Indiana it is on a per county basis[1]. 1. https://www.timeanddate.com/time/us/indiana-time.html https://www.timeanddate.com/time/us/indiana-time.html
- adrianmonk 7y ago
- adtac 7y agoTime is hard: https://zachholman.com/talk/utc-is-enough-for-everyone-right https://zachholman.com/talk/utc-is-enough-for-everyone-right This is all because of the fact that we're trying to represent the time taken by the earth (an arbitrary planet that has no impact on the universe whatsoever) to revolve around the sun (an arbitrary star) in terms of the amount of time the earth takes to rotate around itself. These two obviously unrelated things are somehow merged into to create an unsolvable clusterfuck. To make matters worse, let's sprinkle some politics...
- icxa 7y ago> (an arbitrary planet that has no impact on the universe whatsoever) What do you call this type of worldview where you just view everything as completely meaningless or devoid of any value? Is it really straight up Narcism? I mean my god no wonder this is one of the most depressed generations on record. Apologies for the off-topic comment, I just felt compelled to post this. We are the most meaningful, most important things in the universe until we know or learn otherwise. We are the most intelligent, most accomplished life forms in our known existence. Viewing it as arbitrary might be "technically true" but then again what do we know? What if we are it? It is just as plausible as the other view: that we are just on a billion year course for the eventual heat death of the universe and the end of existence all together. Treat yourselves as special, you are. Treat others that way too. You'll also be a lot happier. Sorry for the platitudes.
- chendragon 7y agoIf I remember correctly the word you're looking for is nihilism.
- laughinghan 7y agoIronically, viewing yourself as the most meaningful, important, intelligent, accomplished thing in the universe sounds a lot like narcissism.
- 7y ago
- deleted 7y ago[deleted]
- thought_alarm 7y agoFalsehood #2: Every day starts at 12:00 am midnight.
- kbumsik 7y agoWot, what's the false case?
- thought_alarm 7y agoDST. Some countries (Brazil) switch over at midnight instead of 2:00 am. One day of the year has no midnight.
- ilikehurdles 7y agoI never considered how many logical problems arise from the use of AM/PM. I knew time handling is tricky but it seems like every time I see this topic discussed, I learn about a new corner case.
- danaliv 7y agoSome cultures end the day at (wait for it...) sunset. And now we're back to the original problem.
- vintermann 7y agoApparently Muslims and Jews here have agreed that the day ends at sunset or at 21:00, whichever comes first (or at all). It would be difficult if you couldn't eat for the better part of a month.
- ncmncm 7y agoBecause there is neither a 12:00 am, nor a 12:00 pm. One is 12 noon, the other is 12 midnight. AM and PM are "ante meridian" and "post meridian": before" and after. But 12 is on* the meridian; neither one. You can meaningfully say 12:00:01 am, or 11:59:59 pm, but for 12 sharp nobody can say whether am or pm is dark or day. Airlines schedule flights at 12:01 for this reason.
- draw_down 7y agoFalsehoods the internet believes about programming: compiling pithy lists of mistaken ideas actually helps programmers do a better job.
- AceJohnny2 7y agocredit to /u/gwern
- a3n 7y agoThis is true, depending on how far away you look from where you are. Or, this is true, if you allow that "day" is defined by sunrise to sunrise (or sunset to sunset, depending on your religion), which in the region discussed would give you one sunrise per revolution around the sun. Either one of those truths could be the basis for fixing this bug. EDIT: Rather than a bug (in the implementation), this may be better classified as an under-specification.
- smudgymcscmudge 7y agoAside from having a falsehoods checklist that includes this, how would this be caught by a programmer who isn’t mindful of the fact that you don’t always have a sunset?
- caf 7y agoConsider the loop conditions (which are clearly non-trivial) and ask "is it certain that this loop will always terminate"? Presumably in this case you would have arrived at an answer along the lines of "yes, so long as there's always a sunset". Which should then prompt the question: hang on, is there always a sunset? A quick scan over whatever datafile it's using for input should answer that.