Comment by staplung
12 hours ago
Clocks like this are fun. I coded one but couldn’t decide how to handle the corner cases where the sun rises but does not set (and vice versa). You also have to decide if you’re showing the time that the sun rose today or if it should be tomorrow once you’ve already passed that time. Either way, at a certain point you’ll see the UI shift. At moderate latitudes it makes little difference but the effect can be quite extreme depending on the latitude and time of year.
> how to handle the corner cases where the sun rises but does not set (and vice versa)
In practice it doesn't matter: you get a thin sliver of twilight between solar midnight and sunrise or sunset, and a 'Sunset: Does not occur' message in the text info. In such cases the sunrise/sunset arc (sector?) is pretty broad anyway.
> or if it should be tomorrow once you’ve already passed that time
Yes. I chose to recalculate the times midnight.
> Either way, at a certain point you’ll see the UI shift
Yes, but it's usually not dramatic. A few minutes time and fractions of a degree each day. The biggest shift occurs when Daylight Saving time changes — you get a big 15° rotation in the display. Most people are asleep when that happens, but it's cool to watch it jump.
I'd want to make it continuous, but then it wouldn't actually show you proper sunset/sunrise times until the moment they are actually happening, which is probably sacrificing function for form. You could also hide the shift by making the whole thing "tick" rather than having some parts continuous and some quantised.