5 ms·
I think I can say this on behalf of most developers who have ever had to fix DST errors in their code: Thank fucking god. I am shocked that none of our unit te
by hinkley 5y ago
I think I can say this on behalf of most developers who have ever had to fix DST errors in their code: Thank fucking god.
I am shocked that none of our unit tests failed on Monday. One of the first code reviews I did here I pointed out that his tests were going to break in a few months when DST kicked in because his tests asserted that there was a 24 hour gap between two calculations. He responded this code was temporary and it would be gone by then.
There was another PR on a certain Monday a few months later. Told ya so.
- eldenbishop 5y agoLOL - this is good timing. A bunch of my unit tests just started failing due to the recent DST transition. Luckily our CI build servers are all GMT so it only failed on local runs. But even better if this problem went away altogether.
- qwertox 5y agoI personally am against timesaving switches, but just because the US stops this practice doesn't mean that the issue is gone. There is nothing to thank for since nothing will change, except for the lack of enforced switches the developers will have to deal with, which may lead to more bugs.
- travisjungroth 5y agoFixed one of these yesterday!
- hinkley 5y agoMy favorite is when they fix 23 hours in the spring and then have to fix 25 hours in the fall, although the reverse is easier to do.
- waqf 5y agoIf this law will solve your problems then I … guess your code doesn't have to work outside the US?
- stjohnswarts 5y agoIt mostly solves the problem of needless clock switch overs twice a year. Quite orthogonal to most software.
- huehehue 5y agoI support the change, but it means we'll have yet another edge case in time handling.
- hinkley 5y agoYou're not wrong. I know people in finance and insurance have to deal with these things in perpetuity because they're always looking backward and forward in time. Banks first starting running into the Y2K problem in 1970, because of 30 year mortgages. Which means they've been dealing with 2038 problems for almost 15 years already. Moving DST is my pettiest reason for disliking George W Bush. Flashbacks to the last few times I had to fix time offsets for some country or state that opted out.
- noveltyaccount 5y agoHah - I always "joke" that when you write code that deals with time zones, plan to write it twice. Same with DST boundaries. It's a real mind-bender!
- treve 5y ago> I think I can say this on behalf of most developers who have ever had to fix DST errors in their code: Thank fucking god. I think it just means for all American developers it's _more_ likely they'll introduce bugs if they cater to an international audience and there's still countries with DST. DST has always been a good way to get Devs to think about the timezone database. If people start relying on offsets more that's not a net good thing, until the entire world is done with DST.
- rory 5y agoYes, but those bugs won't be caught since the test suite has an implicit dependency on the current US time, so they don't count.
- hinkley 5y agoOr GMT. GMT is great for client/server interactions. But users have a habit of wanting things to happen at "8 am on Saturday" and GMT is lousy for things like that.
- 14u2c 5y agoWhat is the issue with that use case? I am a firm believer in storing all time as GMT / UTC in the database layer then converting to local time in the UI layer according to the current user's attributes. In this situation, when the user enters "8 am on Saturday", they would do so in their local time, it would be converted to GMT before inserting, and again back into local time when that record is viewed in the UI.
- kzemek 5y agoExcept when that's an alarm clock time, and the user takes a trip on Friday that moves him -4h worth of timezones. Or if their local legislature suddenly decides to cancel the DST change that was supposed to happen Friday night.
- 5y ago
- jakemal 5y agoThere has to be a law about the permanence of "temporary" code.
- watwut 5y agoIt just became more complicated.
- kevincox 5y agoBut DST isn't the only situation where time changes. Countries (especially those near the international date line) switch back and forth depending on the current economic situation. Plus if you need to deal with historical data DST is still am important detail. So your code will still require this logic, it just may be easier to ignore the bugs of a while.
- rk06 5y agoOne time I hit this issue was in calculating future time. When the future time does not exist (cause it was skipped), it caused app to fail and require manual cleaning of data.
- dgellow 5y agoUnfortunately DST doesn’t just disappear because one country decides to get rid of it. That also creates a lot of weird issues if your program deals with time from the past, you have to know if a specific region, at a given date, was considering DST or not to be accurate with the local time, which can be messy with that type of flip-flop decisions!