Perhaps it's because they implemented the "Sunrise equation" naively, which becomes indeterminate for high latitudes when the Sun is close to the maximum?
Angles are always such a pain. In my experience it's worth applying trigonometric identities and working in terms of unit vectors, sines, and cosines instead of using angles directly. In this case angles seem unavoidable, though: acos(tan(x)*tan(y)) doesn't simplify to anything useful.
This is a beautiful example of the importance of diversity on a team. I have no idea how diverse the team is and I am not speaking of racial or sex diversity... this is the core of the discussion, having people with varying life experiences prevent obvious bugs like this or innovative ideas that no one person could think about. This is a fun bug
Whilst that’s true, I think it’s also a good example of how shortsighted most attempts at diversity are; in this case a Scandinavian would perhaps have the “diverse experience” to preempt a naïve implementation of a sunrise fiction, however diversity seems to always be about race or sex or identity, which seems to miss the point somewhat.
Edit: Which is to say that a male with fair hair and skin and a university education wouldn’t qualify as diverse in most contemporary conceptions of diverse, despite a likely underlying diversity of culture and experience.
That episode proves the point I think. It seems to demonstrate perfectly how the only diversity that counts is race and sex. The article literally concludes with a breakdown of Apple’s workforce by ethnicity and sex.
I believe the first portion of your reply directly supports the original comment here. Everyone's assumptions are based off of their experiences. A diversity of experiences and backgrounds creates an environment where assumptions are challenged more frequently. The more than a team can support their decisions through facts, instead of assumptions, the stronger their solutions will be.
Depends on the state/country, but most have rule that you can't go around more than once. In fact, most places I've seen in the US you can't even go more than 3/4s around (although I'm not sure if that's a law or just a posted suggestion).
> It is illegal to circle a roundabout more than 3 times
> FALSE
> There is no evidence to support this, other than the 'careless driving' argument. You should plan before you enter a roundabout and circling more than twice could be considered as careless driving.
I was pulled over with a few friends after a few loops. One of the roundabout entrances was a hospital. I didn't get a citation of any sort, but the cop basically handwaived with "blocking traffic" (of which there was none).
Basically, it depends how bored your local police are
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!"
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.
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)
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.
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.
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)
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?”
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.
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].
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).
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.
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.
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.
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.
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?
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).
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?
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.
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.
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.
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.
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.
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.
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.
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...
> (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.
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.
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.
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.
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.
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.
When I was working on geo-fencing feature for a small UAV I did see the consequences of naive maths when working with coordinates near antimeridian (e.g. calculating a perpendicular vector of a fence segment).
Also related- it seems crazy to me how some teams are working on a robotic product without building/interating a simulator first!
All he's shown is a behavior (high CPU) and is equating it with the latitude he's at. When he turns off Night Shift, the daemon process for the feature stops consuming as much CPU, from what I gathered. Nowhere does he provide evidence that there is an infinite loop calculating the sunrise/sunset.
And I really don't want to be a stereotypical poster by simply degrading what he did, so I will give credit to him for knowing where to look and making a hypothesis that is not wrong. He's perfectly on point to _begin_ a debugging process, but I can't see he's found a bug. He's found an unexpected or undesired behavior. I certainly would consider this story/tweet as a huge plus if he were being interviewed by me for an engineering position, but it appears he's already well above my pay grade anyways.
You’re splitting hairs and failing at it. They have clearly found a “bug” if Night Shift is consuming 100% CPU without end, even if their hypothesis for the reason might be wrong.
This depends on your definition of "bug". I think, in the classical sense, a bug is something that you understand both the cause and the resultant undesired behaviour and, as of consequence, you can reproduce the chain of events.
Given that definition, I would be disinclined to agree with calling it a "bug".
However, I would also like to point out that we're getting so nuanced in terms that we're, quite literally, dropping the notion of lauding the attempts of the OP to go down the road of wanting to deduce the problem, themselves.
I disagree. If you have to understand the cause of undersires behaivor before a bug can be said to exist, then debugging is a prerequisite to a bug existing.
If I write a program that computes 2+2 and it tells me the answer is 5, that’s a bug. Why is irrelevant until I want to fix it.
As the OP, I'm giving this one an upvote. I am far from an engineer, so the most I can come up with a hypothesis. I need a real engineer to do the real debugging.
A bit late, but I did want to point out that I enjoyed the article and found it engaging. I was not trying to diminish from you in any way. My comment was much more a semantical argument over the comment than a logical disagreement with your article.
Unexpected or undesired behaviours are relative to who's expectations and desires are being considered while bugs are (or at least should be) universally recognisable as bugs.
The machine gave two big hints. The fan spinning up indicated the computer was needlessly busy. Then the Activity Monitor revealed the problem was the "core brightness" system. From there it is a small leap to make the connection to Night Shift.
On mobile devices the only indications we have that something is wrong is warm devices and lower battery lives, which are far less immediate. And we don't have the detailed CPU usage that desktop devices provide. Maybe we need a simulated fan sound when our devices are being pushed too hard.
This Android phone tells me proactively if it notices an application using lots of battery life or network bandwidth. And if I'm inquisitive it will let me see how much they used anyway when it didn't alert.
For example apparently Chrome used 3% of the battery life so far today whereas a game I was just playing already consumed 5%
Reminds me of an early release build of Win95. It would properly set time back an hour for Daylight Saving Time, but not set a flag that it had been done, so it would do it over, and over, and over...
My favorite part of "To the Moon and Back" is when the NASA administrator is explaining to Congress that the three astronauts on board Apollo 1 died because "We weren't creative enough to imagine this could happen."
Maybe, but I don’t think there’s a CoreSunrise or CoreSunset. The problem isn’t in setting the brightness or colour tone, it’s calculation when to switch between them.
> where the sun doesn't rise for a part of the year as well
That would be the same place a few months from now. This is strange though, it's not like this guy is the first above the polar circle using a Mac. I suspect it must somehow be related to him being a tourist with a different region and timezone settings or maybe the location services got confused.
> Now, is this a corner case, an edge case or a boundary case? And does the answer depend on whether you are a flat-earther or not?
That was too funny.