News for hackers. Stuff that matters.
Re:Infinite loop in macOS Night Shift in the summer near the... by gberger on Friday June 28, 2019 @05:23PM (#20308890)
'Falsehoods programmers believe about time: - Every day has a sunrise and a sunset'
Re:Infinite loop in macOS Night Shift in the summer near the... by stcredzero on Friday June 28, 2019 @05:48PM (#20309048)
Falsehoods 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!"

Re:Infinite loop in macOS Night Shift in the summer near the... by ergothus on Friday June 28, 2019 @06:08PM (#20309166)
I 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.

Re:Infinite loop in macOS Night Shift in the summer near the... by inlined on Friday June 28, 2019 @06:35PM (#20309350)
My 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)
Re:Infinite loop in macOS Night Shift in the summer near the... by jws on Friday June 28, 2019 @10:26PM (#20310417)
DST rules are just insane. I'm responsible for some code where I just drew the line and 40 some odd people in one of the Antarctic stations are just going to have to live with wrong time part of the year if they ever run my code. I'm not adding another code path and test case just because these people wanted their own special concept of time. I don't remember the pattern, but I think it was maybe a daylight savings time and then an extra one stacked in the middle.
Re:Infinite loop in macOS Night Shift in the summer near the... by petre on Saturday June 29, 2019 @12:09AM (#20310769)
We have endless problems with DST as well. I can't wait for the EU directive that abolishes it. Russia dropped it years ago. We'll still have to support past times and other timezones though.
Re:Infinite loop in macOS Night Shift in the summer near the... by meepso on Saturday June 29, 2019 @05:42AM (#20311674)
I wonder how long time it will take to forget DST if it is abolished. Will that messy spaghetti code be ripped out and never seen again.
Re:Infinite loop in macOS Night Shift in the summer near the... by jon-wood on Saturday June 29, 2019 @06:58AM (#20311891)
Most standard libraries still have support for the Julian calendar. That stuff is never going away.
Re:Infinite loop in macOS Night Shift in the summer near the... by jki275 on Sunday June 30, 2019 @08:32AM (#20317858)
Julian calendar is still used by the US Navy. Every supply department office you go into has a conversion table up on the wall.
Re:Infinite loop in macOS Night Shift in the summer near the... by mkl on Saturday June 29, 2019 @08:08AM (#20312119)
I doubt it's "most". Python, Javascript, and C++ don't seem to. The only ones I found that do seem to are C# and Java.
Re:Infinite loop in macOS Night Shift in the summer near the... by inlined on Saturday June 29, 2019 @04:46PM (#20314684)
I just got a ruby gem from someone who actually made tables on the stuff. I made a script that cut out far past and future times to lower loading time from 10m to 30s and figured I could upgrade the gem to leverage an expert’s research as timezones changed (e.g. India changing zones)
Re:Infinite loop in macOS Night Shift in the summer near the... by mason55 on Friday June 28, 2019 @07:04PM (#20309540)
Yeah I always feel like a jerk when people open tickets in the summer saying “Please do this at #:## EST” and I have to reply “thanks for providing a time but it’s currently EDT in NYC. Is that what you meant?”
Re:Infinite loop in macOS Night Shift in the summer near the... by wil421 on Friday June 28, 2019 @10:48PM (#20310496)
No reason to be snarky with people. They mean whatever time it currently is or will be.
Re:Infinite loop in macOS Night Shift in the summer near the... by heavenlyblue on Saturday June 29, 2019 @08:51AM (#20312293)
Are you sure though?

If they copied that date from some automated system it might as well be any of these.

Humans usually say “New York time”.

Re:Infinite loop in macOS Night Shift in the summer near the... by eridius on Sunday June 30, 2019 @01:50AM (#20316589)
In my experience, humans never say "New York time", or "San Francisco time", or anything like that, they say "EST" and "PST" regardless of whether daylight saving's is on.

I'm guilty of this too, since I can never remember which part of the year constitutes "on" and which is "off", only where the boundaries are. If I stop and think I can usually remember "spring ahead is turning it on", but never off the top of my head.

Re:Infinite loop in macOS Night Shift in the summer near the... by lopmotr on Saturday June 29, 2019 @04:03AM (#20311391)
That's only slightly worse than how I feel when people say that something's happening in the summer when it's actually winter where I live.
Re:Infinite loop in macOS Night Shift in the summer near the... by michaelmior on Friday June 28, 2019 @08:17PM (#20309940)
I hear you. It almost always is what people meant but most of us (myself included) rarely think about the distinction.
Re:Infinite loop in macOS Night Shift in the summer near the... by jimktrains2 on Friday June 28, 2019 @09:00PM (#20310102)
I've just gotten to saying ET (or equivalent) all year-round .
Re:Infinite loop in macOS Night Shift in the summer near the... by macintux on Friday June 28, 2019 @09:13PM (#20310159)
That’s the battle I fight: persuading people that saying “Eastern” is accurate and sufficiently precise. Precise and inaccurate is a bad combination.
Re:Infinite loop in macOS Night Shift in the summer near the... by adrianmonk on Friday June 28, 2019 @06:54PM (#20309472)
That becomes fairly obvious when you consider Arizona doesn't observe DST, but Utah is the same longitude (lies directly north) and does observe DST.
Re:Infinite loop in macOS Night Shift in the summer near the... by filoleg on Friday June 28, 2019 @07:10PM (#20309576)
Yep. 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

Re:Infinite loop in macOS Night Shift in the summer near the... by adrianmonk on Friday June 28, 2019 @07:28PM (#20309683)
Speaking of within, I fibbed slightly about Arizona.

https://en.wikipedia.org/wiki/Time_in_Arizona

The Navajo Nation is within Arizona's boundaries, and it does observe DST. And the Hopi Reservation is within the Navajo Nation, and it does not observe DST.

And since Arizona is surrounded by California, Nevada, Utah, New Mexico, and Mexico, all of which do observe DST, that means you have an island of no-DST (Hopi) inside an island of DST (Navajo) inside an island of no-DST (Arizona) inside an area of DST (adjoining US states plus Mexico).

Re:Infinite loop in macOS Night Shift in the summer near the... by bpye on Friday June 28, 2019 @09:54PM (#20310324)
How did we screw up time zones so much?
Re:Infinite loop in macOS Night Shift in the summer near the... by SllX on Saturday June 29, 2019 @12:39AM (#20310844)
We invented and then implemented time zones and then invented and then implemented daylight savings time; arbitrarily and with arbitrary laws and treaties.

There are days where I think I should go back to a mechanical watch and adjust the time each day at high noon. It won’t agree with anyone else’s time most of the time, but at least it will be correct.

Re:Infinite loop in macOS Night Shift in the summer near the... by jfk13 on Saturday June 29, 2019 @05:31AM (#20311649)
But won't it be wrong as soon as you start travelling east or west, though?
Re:Infinite loop in macOS Night Shift in the summer near the... by danaliv on Friday June 28, 2019 @09:04PM (#20310110)
Well that's almost enough to make one think daylight saving time is a bunch of cracked-up nonsense!
Re:Infinite loop in macOS Night Shift in the summer near the... by macintux on Friday June 28, 2019 @09:14PM (#20310166)
Somewhere I have an old book which includes time zone maps for Indiana in the 50s and 60s. Every single year there were changes.
Re:Infinite loop in macOS Night Shift in the summer near the... by foobarchu on Monday July 01, 2019 @09:02PM (#20331210)
There's also half hour timezones, found at least in India, and I think a couple quarter hour zones.
Re:Infinite loop in macOS Night Shift in the summer near the... by jpindar on Saturday June 29, 2019 @10:21AM (#20312735)
And that it's possible for two places to be more than 24 hours apart.
Re:Infinite loop in macOS Night Shift in the summer near the... by stcredzero on Friday June 28, 2019 @06:51PM (#20309454)
but that the tone I read in your words would prevent people from improving

Are people really that fragile? Yes and no.

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.

Isn't humility the answer to both? Someone should develop a humility course for programmers involving an "ultra drone," writing the date/time library for it, and some simulated world test cases. Such "humility exercises" are found in various disciplines. There's one for CIA analysts, involving analyzing US Civil War sites via sat photos, then having them visit in person.

Re:Infinite loop in macOS Night Shift in the summer near the... by ergothus on Friday June 28, 2019 @07:16PM (#20309609)
> Are people really that fragile?

It's not fragility, so much as perspective.

When you are thinking something is simple, and you say "Am I'm thinking I'm impressed with my own cleverness?" it's easy to say "no". Because it's not arrogant to think you can accomplish something simple.

When you are thinking something is simple, and you say "Am I assuming simplicity?" it's easy to say "yes".

Realizing you're committing the fallacy is the first step to avoiding it.

Re:Infinite loop in macOS Night Shift in the summer near the... by rosser on Friday June 28, 2019 @05:33PM (#20308946)
Right? 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.
Re:Infinite loop in macOS Night Shift in the summer near the... by gubbrora on Friday June 28, 2019 @10:08PM (#20310361)
If we tried to get these thing 100% right we'd not have time for anything else. Punting is pragmatic.
Re:Infinite loop in macOS Night Shift in the summer near the... by rosser on Saturday June 29, 2019 @01:01AM (#20310891)
You'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?

Re:Infinite loop in macOS Night Shift in the summer near the... by gubbrora on Saturday June 29, 2019 @10:11AM (#20312683)
Agreed
Re:Infinite loop in macOS Night Shift in the summer near the... by danaliv on Friday June 28, 2019 @09:05PM (#20310120)
And it's a reminder that "edge case" is relative. It's not an edge case for people who live there!
Re:Infinite loop in macOS Night Shift in the summer near the... by vortico on Friday June 28, 2019 @05:33PM (#20308948)
It exists, it's just complex-valued.
Re:Infinite loop in macOS Night Shift in the summer near the... by ummwhat on Friday June 28, 2019 @05:39PM (#20308980)
True that

(Posted at (5+4i):(37+5.23812i) AM)

Re:Infinite loop in macOS Night Shift in the summer near the... by inlined on Friday June 28, 2019 @06:37PM (#20309360)
Where does j & k fit into your quaternion representation?
Re:Infinite loop in macOS Night Shift in the summer near the... by simongr3dal on Friday June 28, 2019 @06:19PM (#20309244)
There are both coordinates and rotations, it would probably be better modeled as a quarternion or something of an even higher order.
Re:Infinite loop in macOS Night Shift in the summer near the... by vortico on Friday June 28, 2019 @08:13PM (#20309921)
I 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).
Re:Infinite loop in macOS Night Shift in the summer near the... by smudgymcscmudge on Friday June 28, 2019 @09:23PM (#20310212)
Aside 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?
Re:Infinite loop in macOS Night Shift in the summer near the... by caf on Friday June 28, 2019 @11:56PM (#20310734)
Consider 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.

Re:Infinite loop in macOS Night Shift in the summer near the... by thought_alarm on Friday June 28, 2019 @06:39PM (#20309373)
Falsehood #2: Every day starts at 12:00 am midnight.
Re:Infinite loop in macOS Night Shift in the summer near the... by ncmncm on Friday June 28, 2019 @09:17PM (#20310179)
Because 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.

Re:Infinite loop in macOS Night Shift in the summer near the... by ajuc on Saturday June 29, 2019 @08:17AM (#20312151)
This is the reason 24hour clock is the way to go. 23:59, 00:00, 00:01, ...

0 was invented for a reason. This am/pm stuff is so confusing.

Re:Infinite loop in macOS Night Shift in the summer near the... by lwansbrough on Friday June 28, 2019 @10:47PM (#20310494)
Meridian in this context is noon. 12 “anti meridian” is 12 hours before noon. 12am. Which is exactly correct.

I’m no domain expert but I’m guessing flights are scheduled at 12:01am because people are bad at time. For instance some people would think 12am is the last minute of the previous day instead of the first minute of the next day. 12:01 removes the potential ambiguity.

Re:Infinite loop in macOS Night Shift in the summer near the... by nothrabannosir on Saturday June 29, 2019 @04:14AM (#20311418)
Nitpick but since we’re talking about time: AM means “ante meridiem”, as in “before”. Not anti as in “against” :)
Re:Infinite loop in macOS Night Shift in the summer near the... by OJFord on Saturday June 29, 2019 @07:20AM (#20311952)
You've just completed GP's point perfectly though - 12 hours after noon (post meridian) is midnight too.
Re:Infinite loop in macOS Night Shift in the summer near the... by Mountain_Skies on Friday June 28, 2019 @11:05PM (#20310555)
12 "post meridian" is 12 hours after noon. 12pm. Which is midnight. But you don't use 12pm to mean midnight. Why not? Midnight doesn't actually belong to a day at all. Our current conventions of 12am and 12pm seem to be mostly products of digital time keeping.
Re:Infinite loop in macOS Night Shift in the summer near the... by Symbiote on Saturday June 29, 2019 @04:35AM (#20311477)
OU4483 leaves CPH at 1200, as does another flight.

There isn't a flight at midnight, but there are fewer flights then anyway, and it may be confusing to some which day the flight is on. Of course, the flights around midnight have departure times of 2350 and 0015.

Re:Infinite loop in macOS Night Shift in the summer near the... by kbumsik on Friday June 28, 2019 @07:17PM (#20309620)
Wot, what's the false case?
Re:Infinite loop in macOS Night Shift in the summer near the... by thought_alarm on Friday June 28, 2019 @08:20PM (#20309952)
DST. Some countries (Brazil) switch over at midnight instead of 2:00 am. One day of the year has no midnight.
Re:Infinite loop in macOS Night Shift in the summer near the... by ilikehurdles on Saturday June 29, 2019 @12:29PM (#20313420)
I 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.
Re:Infinite loop in macOS Night Shift in the summer near the... by danaliv on Friday June 28, 2019 @09:11PM (#20310147)
Some cultures end the day at (wait for it...) sunset.

And now we're back to the original problem.

Re:Infinite loop in macOS Night Shift in the summer near the... by vintermann on Saturday June 29, 2019 @12:03PM (#20313301)
Apparently 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.
Re:Infinite loop in macOS Night Shift in the summer near the... by AceJohnny2 on Friday June 28, 2019 @08:26PM (#20309979)
credit to /u/gwern
Re:Infinite loop in macOS Night Shift in the summer near the... by adtac on Friday June 28, 2019 @06:25PM (#20309293)
Time is hard: 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...

Re:Infinite loop in macOS Night Shift in the summer near the... by kstenerud on Saturday June 29, 2019 @01:25AM (#20310940)
I was hoping that he'd cover the different kinds of time, and where each kind is used in a program, but nobody seems to think about it:

* Absolute Time: A time value fixed to UTC.

* Fixed Time: A time value fixed to a specific time zone.

* Floating Time: A time value that is interpreted according to the time zone of the observer.

https://technicalsourcery.net/posts/time/

Re:Infinite loop in macOS Night Shift in the summer near the... by icxa on Friday June 28, 2019 @06:49PM (#20309437)
> (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.

Re:Infinite loop in macOS Night Shift in the summer near the... by chendragon on Friday June 28, 2019 @06:54PM (#20309471)
If I remember correctly the word you're looking for is nihilism.
Re:Infinite loop in macOS Night Shift in the summer near the... by laughinghan on Friday June 28, 2019 @07:11PM (#20309581)
Ironically, viewing yourself as the most meaningful, important, intelligent, accomplished thing in the universe sounds a lot like narcissism.
Re:Infinite loop in macOS Night Shift in the summer near the... by delinka on Friday June 28, 2019 @07:31PM (#20309707)
When your "universe" is the size of a solar system with a single life-supporting planet, what other conclusion could possibly be met?

If you're the only one in a talent contest, you're the best ... and the worst.

Re:Infinite loop in macOS Night Shift in the summer near the... by nkrisc on Friday June 28, 2019 @08:37PM (#20310026)
I like life, but we are meaningless motes in the universe. We'll all be dead one day and no one will remember us.

It's ok though, it doesn't matter.

Re:Infinite loop in macOS Night Shift in the summer near the... by sapilla on Friday June 28, 2019 @09:20PM (#20310196)
If human matters do not matter, why assume that language carries meaning?

Do you believe that animals have meaningful conversation? Or that humans do?

Does the universe speak? If it did, would you know?

Do you understand its language? Can you hear it?

There's also something else: nothing.

Re:Infinite loop in macOS Night Shift in the summer near the... by karpodiem on Friday June 28, 2019 @09:00PM (#20310098)
I've learned to enjoy the struggle and this has helped me immensely.
Re:Infinite loop in macOS Night Shift in the summer near the... by kortilla on Friday June 28, 2019 @07:02PM (#20309520)
It’s not an arbitrary planet from our perspective, which is the only one we even know to exist.

We’ve needed to coordinate actions forever and the sun was the only reliable way to do that for a long time. Nothing arbitrary about where our time came from.

Re:Infinite loop in macOS Night Shift in the summer near the... by derefr on Friday June 28, 2019 @07:13PM (#20309592)
Sure, for now; but I feel like it'd be aesthetically pleasing in some sense to try for something more objective—i.e. to predetermine the sort of timekeeping methods we would need upon establishing trade relations with a universe full of aliens, and then to use those methods in advance. Like a Society for Creative Anachronism meeting where the target period is forward in time rather than backward.
Re:Infinite loop in macOS Night Shift in the summer near the... by jakelazaroff on Friday June 28, 2019 @07:56PM (#20309837)
Given that we have no idea whether aliens even exist — and that life on Earth both literally and figuratively revolves around the Sun — that strikes me as the ultimate premature optimization.
Re:Infinite loop in macOS Night Shift in the summer near the... by SllX on Saturday June 29, 2019 @12:46AM (#20310862)
If we ever meet aliens that also happen to be advanced enough to trade with, we will have already solved this issue ourselves because we’re cruising around in the Enterprise and needed a new timekeeping system by that point, or the Enterprise came to us and they will have their own timekeeping system that we can adopt.

Before then? Eh. Objectivity is overrated and an imperfect time system is a nice reminder that life doesn’t revolve around us and what we want.

Re:Infinite loop in macOS Night Shift in the summer near the... by a3n on Friday June 28, 2019 @09:01PM (#20310106)
This 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.