I'm ok with timezones, but the guy who invented daylight savings time I'd slap to all the way to the sun
Programmer Humor
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
From a development perspective it certainly sounds easier to have one global timezone with DST than a bunch of smaller ones without it. Would that make sense in reality? Probably not but I definitely think timezones take more work to compensate for properly.
What matters is consistency and our time system has tons of crazy inconsistent shit in our. Everyone knows about leap years, but do you know about leap seconds? Imagine trying to write a function to convert unix time to a current date and suddenly all your times are a second off.
Just look at this insane bullshit nonsense. The added complexity of time zones and daylight saving time is nothing compared to simply supporting our time system.
Worked on a project where devices just magically froze, but only during the month of February!
Turned out the people who had written the firmware had decided to do their own time math to save space and had put in an exception in the code for leap year values. Except instead of February 29th, it kicked in for the whole month. And the math was wrong so you ended up with negative values.
The product was due for launch in March of that year and was headed to manufacturing. It was by sheer luck that someone ran a test on February 1st and caught the problem.
Don't mess with time in code, kids.
This is why we have pre-built libraries and Unix time.
Embedded portable device with a teeny ARM processor. Sadly, no room for linux anything or even an RTC. Every time it connected to a phone, the phone would set its clock so the timestamps were somewhat close to being accurate.
However, if you swapped out the AAA battery and DIDN'T connect it to the phone at least once, all your subsequent readings would go back to zero epoch and would be forgotten 🤷🏻♂️
Good times.
Some absolute and utter legend of a man made a Unix kernel for the fucking ZILOG Z80, you have no excuses
(It's called UZI and it's written in K&R C for some obscure CP/M compiler)
If it had been up to me, I would have included a proper real-time-clock in the design and done things a lot differently.
But the device was designed by one company and the BLE and processor module by another. For some ungodly reason neither trusted each other, so nobody was given access to the firmware source on either side. I worked for a third company that was their customer paying the bill. I was allowed to see the firmware for both sides, but only read only, on laptops provided by each company, one at a time, in a conference room with their own people watching everything. Yeah, it was strange.
I was there because the MCU and the BLE processor sometimes glitched and introduced random noise. Turned out the connection between the two parts were unshielded UART with no error detection/correction 🤦🏻♂️
It was concidental that we hit the date glitch. Took all our effort just to get them to add a checksum and retry. The tiny MCU was maxed out of space. No way to fit in any more code for date math.
Ok so there are 24 time zones. Before that every town had their own time based on the sun. We basically went from infinity time zones down to 24. This is in fact simpler.
(There are some half hour time zones too, (India, Newfoundland) so at least 26.)
There are a few time zones that are 45 minutes off, like Nepal Standard Time which is UTC+5:45, some places in Western Australia and South Australia use UTC+08:45 and the Chatham Islands are at UTC+12:45 or UTC+13:45 in summer.
DST means you also have things like CST vs CET and given some places start DST earlier or later than others and some ignore it all together, we probably have at least 50 time zones.
Always fun trying to schedule international regular meetings when suddenly there's a week when half the people's times changed and the other half's times haven't yet, so you try to figure out which time would exclude the fewest essential people.
there are 24 time zones
Cunningham's law says that this will generate some discussion in the replies!
Soon we're going to have a new timezone for the moon. Yay, I guess?
Surely they will just use utc?
Can't be that simple due to time dilation effect. Time moves at a different rate in moon, about ~~1s~~ 58.7 μs difference per day.
https://www.reuters.com/science/white-house-directs-nasa-create-time-standard-moon-2024-04-02/
That article says 58.7 microseconds per (Earth) day. Not 1s.
Shit you're right, I misremembered it.
Appreciate you correcting your post, just one more needed.
ms = milliseconds
us = microseconds
not a programmer myself, but actually fuck you, UTC was the correct choice, anything that isn't UTC is a wrong choice, and i will literally fight to my death over this.
Timezones are dumb and stupid, and you cannot convince me otherwise, so far the single best argument i've heard is "well actually, the hands on a clock and the numbers themselves roughly represent the cycle of the sun in the sky during the day." Which is pretty good, until you realize that clocks tend to be circles, and you can often just rotate them. And suddenly, the numbers now match up perfectly. But i've also never once heard of someone caring about that specific feature, so uh. Good riddance frankly.
Timezones kind of made sense back in the day, when the sun was the only realistic timing system, and pre internet, when people stayed where they were. But now that people don't do that, and the internet tends to do this thing where it exists. I refuse to believe it makes more sense to have timezones than not.
"Hmmm yes please, i would like to order the time here, but halfway across the globe please" - statements dreamed up by the utterly insane.
ok that concludes my rant. Now i'm going to go set FUCKING DAYLIGHT SAVINGS TIME on my clock because FOR SOME REASON THE TIME JUST CHANGES HALFWAY THROUGH THE YEAR FUCK YOU.
The guy that invented time zones was solving a problem where each little town had their own time standard. I don't think that was sustainable.
Before timezones and trains, each town had its own natural time (based on the sun or whatever). Would you have preferred that?
I used to feel this way. Over the course of building out 2 calendar systems in my career (so far) and having to learn the intricacies of date and time-related data types and how they interact with time zones, I don’t have much disdain for time zones. I’d suggest for anyone who feels the same way as this meme read So You Want To Abolish Time Zones.
Also, programmers tend to get frustrated with time zones when they run into bugs around time zone conversion. This is almost always due to the code being written in a way that disregards the existence of times zones until it’s needed and then tacks on the time zone handling as an afterthought.
If any code that deals with time takes the full complexities of time zones into account from the get-go (which isn’t that hard to do), then it’s pretty straightforward to manage.
This did little to convince me that timezones are an unnecessary construct. Pretty much every point made was done from the perspective of someone who had already decided their opinion rather than objectively weighing the pros and cons.
I feel you're conflating TimeZones with ever-changing Daylight Savings time rules.
True but so do most computers. Computers have a database of timezones and time offsets around the world. Depending on the UTC date and time, and your current timezone it will look up what offset to apply to show the local time. The database is very gnarly since rules change over time, e.g. maybe in the 70s some countries had longer DST to counteract oil shortages.
You don't have to go back to the 70s for changes. Kazakhstan has changed from two time zones to one just about a month ago.
Cool, so sunrise is at 8 PM now. Or maybe there's just no consistent relationship between what a clock on the East and West coast of America say, and a call can't be scheduled between them.
The real problem with time and date is that it has to fit social and natural systems as well as actual passage of time. A lot of nuance is unavoidable.
Yeah, tbh the "no timezones" approach comes with its own basket of problems that isn't necessarily better than the "with timezones" basket. The system needed to find a balance between being useful locally, but intelligible across regions. Especially challenging before ubiquitous telecommunications
Imagine having to rethink the social norms around time every time you travel or meet someone from far away. They say "Oh I work a 9-to-5 office job" and then you need to figure out where they live to understand what that means. Or a doctor writes a book where they recommend that you get to bed by 2:00PM every night, and then you need to figure out how to translate that to a time that makes sense for you.
We'd invent and use informal timezones anyway, and then we'd be writing Javascript functions to translate "real" times to "colloquial" times, and that's pretty close to just storing datetimes in UTC then translating them to a relevant timezone ad hoc, which is what we're already doing.
That's what my rational programmer brain says. My emotional programmer brain is exactly this meme.
I've just said 'fuck it' and switched all my clocks to UTC. I don't even care anymore.
But if time travel is a thing, imagine the whole new time nightmares! Oh you went back a year with your phone? Now all your TLS root certs are invalid because you're before the start date. Or you have files/emails/whatever that are dated in the future. I guess you can get to that state by just setting your clock forward but I imagine some stuff would break.
I once developed an electronic program guide for a cable TV company in New Zealand and I'd lose my mind if I had to use timezones. The basic rule of thumb was:
a) Internally you use UTC religiously. UTC is the same everywhere on Earth, time always goes forward, most languages have classes that represent instants, durations etc. In addition you make damned sure your server time is correct and UTC.
b) You only deal with timezones when presenting something to a user or taking input from a user
Prior to that I had worked for a US trading company that set all their servers to EST and was receiving trades through the system which expressed time & date ambiguously. Just had to assume everywhere that EST was the default but it was just dumb programming and I bet to this day every piece of code they develop has time bugs.
Except if there was only one zone of time that would be hell to program too because then you would need to check for different times of day for different locations. I think programming is just difficult lol
The UK press every year makes a huge song and dance in opinion pieces about getting rid of DST. However I'm always horrified to see that people want us to keep British Summer Time instead of Grenwich Mean Time. I understand that there are "longer evenings" in BST; however we literally invented GMT and coerced the rest of the world to adjust their times based on that. From the point of view of being constantly compatible with UTC and having more consistent business hours for international companies it makes more sense to me if we kept GMT.
Also the longer evenings thing can be achieved by simply staying up an hour later. It's not exactly like an hour is being stolen from you when the times switch, the change of clocks are mainly pointless admin.
Lastly I read an article recently that described a correlation between the incidence of heart attacks and the clocks changing. The theory is that just slightly messing with people's sleeping patterns can cause additional strain on the body.
No the longer evenings are achieved by work starting and ending an hour earlier. And it's literally easier to change the time zone than to change corporate culture.