News for hackers. Stuff that matters.
Re:Simple, correct, fast: in that order by lopatin on Monday July 09, 2018 @10:07AM (#17490236)
I think it's more in the spirit of the article to say, forget timezones, use UTC millis everywhere. If the server doesn't speak in timezones, then you eliminated all bugs where the server mishandles timezones.
Re:Simple, correct, fast: in that order by masklinn on Monday July 09, 2018 @11:23AM (#17490884)
> I think it's more in the spirit of the article to say, forget timezones, use UTC millis everywhere. If the server doesn't speak in timezones, then you eliminated all bugs where the server mishandles timezones.

That's a flagrant example of "simple and wholly incorrect". If you don't store timezones, your future dates will eventually turn out incorrect when timezone offsets change e.g. create a meeting at 9AM local, store as UTC, country decides to not follow DST that year bam your reminder will ping an hour early or late.

Or a day off when the country decides to jump across the international date line (https://en.wikipedia.org/wiki/International_Date_Line#Samoan...).

Re:Simple, correct, fast: in that order by y4mi on Monday July 09, 2018 @02:26PM (#17492304)
most applications don't need to schedule events into the future though and its a smart strategy if all you need to worry about is the past
Re:Simple, correct, fast: in that order by masklinn on Tuesday July 10, 2018 @02:39AM (#17495905)
For very specific cases? Sure, but none of the comments talking about UTC everywhere cares to specify this rather important bit.

Unless restrictions are specified I will assume we're talking about the general case, and for the general case it's just plain wrong.

Re:Simple, correct, fast: in that order by y4mi on Tuesday July 10, 2018 @09:10AM (#17497702)
from my point of few its the other way around.

There are very few applications that need to schedule events into the future, and that is literally the only situation where you have to worry about the timezone.

Btw, keeping the timezone is insufficient as well if you're building a calendar/scheduler. If the user changes the timezone after scheduling the event... do you keep to the old one and alert him whenever, or do you adjust? There are a lot of edge cases with schedulers -- yet as i said before, most applications don't schedule into the future. They're mostly just doing things right now or within the next few minutes and keeping a log of their actions.

Re:Simple, correct, fast: in that order by masklinn on Tuesday July 10, 2018 @09:19AM (#17497782)
> from my point of few its the other way around.

> There are very few applications that need to schedule events into the future, and that is literally the only situation where you have to worry about the timezone.

My experience is the exact opposite: there are few applications which only store past dates, and in those said date is usually indicative/barely even relevant and could just as well be part of a freeform comment or removed entirely.

Re:Simple, correct, fast: in that order by dredmorbius on Monday July 09, 2018 @11:27AM (#17490922)
The UTC example allows the user to translate output using localised tools.

The solution isn't incorrect, it is modular.

Re:Simple, correct, fast: in that order by masklinn on Monday July 09, 2018 @11:29AM (#17490941)
> The UTC example allows the user to translate output using localised tools.

So you provide an alarm clock which is works as neither a clock nor an alarm.

> The solution isn't incorrect, it is modular.

It's either not correct or not a solution, either way it's useless.

I also like how proponents of "simplicity at all cost" apparently assume/assert the composition of two systems is no more complex than either, and that there is no additional complexity to the composition layer.

Re:Simple, correct, fast: in that order by s3m4j on Monday July 09, 2018 @10:26AM (#17490364)
In my experience, it's been easier to push UTC time all the way from the db to the user javascript and operate on time then, than trying to manipulate time before sending to the user. YMMV, and it's only web dev.
Re:Simple, correct, fast: in that order by marcosdumay on Monday July 09, 2018 @10:33AM (#17490414)
There are many kinds of data that get saved as time. For some, yes, it's better to add and remove the TZ at the interface. For some the TZ carries meaning by itself, and it must be stored and keep constant everywhere. For some the TZ carries meaning, but the time must be converted for display.

Know your data, and most of your problems get easy.

Re:Simple, correct, fast: in that order by everybodyknows on Monday July 09, 2018 @06:29PM (#17493928)
Yes, that's the crucial distinction -- whether the TZ, with its coarse encoding of the geography of origin, carries significance to the consumer of the data.
Re:Simple, correct, fast: in that order by taeric on Monday July 09, 2018 @10:30AM (#17490394)
This works for things that have happened. It doesn't work too well for schedules. In those cases, the timezone of the source matters, heavily.
Re:Simple, correct, fast: in that order by majewsky on Monday July 09, 2018 @10:43AM (#17490494)
For example, a task that occurs "daily at 15:00" does not always happen every 24 hours. When DST comes into effect, the interval shortens to 23 hours once.
Re:Simple, correct, fast: in that order by falcolas on Monday July 09, 2018 @03:13PM (#17492658)
Or, at "2:30 am" in the continental US can occur twice in a day, or not at all. Of course, even that isn't guaranteed, if you're in AZ.

Even "notify me in exactly 24 hours has its own complications. Leap seconds will screw up your day (as will the vague request of "exactly 24 hours").

Corner cases, the bane of simplicity everywhere.

Re:Simple, correct, fast: in that order by s3m4j on Monday July 09, 2018 @02:34PM (#17492367)
To this day, knock on wood, I have had success at voluntarily avoiding those issues ^^ (aside from school assignements)
Re:Simple, correct, fast: in that order by SamuelAdams on Monday July 09, 2018 @10:34AM (#17490423)
I agree - UTC is the way to go. The point of the example was to illustrate how simple could be detrimental to a significant portion of your userbase.

How about another example? You're building an android application. Let's pretend there's an API in the latest version of Android that reduces a dozen lines of code down to one function call - ShinyNewMethod().

You can use that ShinyNewMethod() call. It's certainly simpler.

But the vast majority of android devices in use are not running the latest OS. So the NewShinyMethod(), while being simple, will cause your app to not work for them.

Hopefully the framework designers figured a way to have this auto-reverse engineer for older devices, but that's not always a guarantee.

Re:Simple, correct, fast: in that order by AstralStorm on Tuesday July 10, 2018 @01:51AM (#17495755)
This results in funny things like android support library.
Re:Simple, correct, fast: in that order by jstimpfle on Monday July 09, 2018 @10:35AM (#17490428)
But no, what about UTC leap seconds? Use TAI! :)))