this post was submitted on 29 Jun 2024
886 points (94.7% liked)

Programmer Humor

32710 readers
1162 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] TootSweet 145 points 5 months ago* (last edited 5 months ago) (31 children)

The creator of DST gets the first slap. Then the timezones asshole.

I'm planning to do a presentation at work on how to deal with dates/times/timezones/conversion/etc in the next few weeks some time. I figure it would be a good topic to cover. I'm going to start my talk by saying "first, imagine there is no such thing as timezones or DST." And then build on that.

[–] dgmib 86 points 5 months ago (2 children)

Sandford Fleming (the guy who invented time zones) actually made it easier.

Before timezones, every town had their own clock that defined the time for their town and was loosely set such that “noon is when the sun is at its highest point in the sky.” Which couldn’t be measured all that accurately.

If it wasn’t for Fleming, we’d be dealing with every city or town having a separate time zone.

[–] HeyThisIsntTheYMCA 30 points 5 months ago (4 children)

Save a slap for the dude who invented sundials, and another slap for the dude who invented civilization.

[–] [email protected] 13 points 5 months ago (2 children)

Some asshole had the idea to water a seed and now I have to pay taxes. Fuck that guy.

load more comments (2 replies)
load more comments (3 replies)
[–] [email protected] 9 points 5 months ago (3 children)

Everyone complaining about timezones is truly missing the forests for the trees.

load more comments (3 replies)
[–] Sanctus 34 points 5 months ago (2 children)

Imagine, if we were just all on the same time. It'd just make things, a little easier.

[–] [email protected] 64 points 5 months ago* (last edited 5 months ago) (4 children)

All in the same time? But... Then the sun might go down at noon. That doesn't make sense...

Wait... Noon? Noooon...

The word noon comes from a Latin root, nona hora, or "ninth hour." In medieval times, noon fell at three PM, nine hours after a monk's traditional rising hour of six o'clock in the morning. Over time, as noon came to be synonymous in English with midday, its timing changed to twelve PM.

Oh now that's worse

load more comments (4 replies)
load more comments (1 replies)
load more comments (29 replies)
[–] BigMikeInAustin 70 points 5 months ago (6 children)

It's pretty simple, actually. A village somewhere in Europe that is completely in the shade all day for part of the year has already proven it.

Mirrors.

We just need a ring of motorized mirrors around the Earth.

At hour 0, the mirrors will rotate to show sun all across the entire Earth.

At hour 12, the mirrors will rotate to put all of the Earth into night time.

That lets the entire Earth have the exact same synchronized time synchronized with the daylight.

The mirrors will block the sun from parts of the earth facing during the night.

The mirrors will constantly be rotating to keep the proper amount of sun light facing each part of Earth as the Earth rotates.

The mirrors will be solar powered.

This will fix it, right?

[–] SVcross 41 points 5 months ago

I don't see any way whatsoever that could mean this project is not viable.

[–] [email protected] 28 points 5 months ago

Now I'm thinking about an ex-programmer supervillain who does this as her big foray into supervillainy

[–] [email protected] 10 points 5 months ago

Sounds feasible.

[–] [email protected] 9 points 5 months ago* (last edited 5 months ago) (3 children)

Alternatively, we have this arbitrary standard of 9am means morning, if we share a single universal time, different places would just have a different arbitrary time being the "morning" instead.

[–] mojo_raisin 10 points 5 months ago* (last edited 5 months ago) (3 children)

Or, we could collectively realize time is but an illusion and transcend this silly problem.

load more comments (3 replies)
load more comments (2 replies)
load more comments (1 replies)
[–] [email protected] 60 points 5 months ago (8 children)

obligatory: https://qntm.org/abolish

Before I read this article, I also thought it would be a great idea to get rid of timezones entirely and just use UTC for everything. To quote from the link, (please forgive me for being lazy and not formatting it correctly)

Abolishing time zones brings many benefits, I hope. It also:

  • causes the question "What time is it there?" to be useless/unanswerable
  • necessitates significant changes to the way in which normal people talk about time
  • convolutes timetables, where present
  • means "days" (of the week) are no longer the same as "days"
  • complicates both secular and religious law
  • is a staggering inconvenience for a minimum of five billion people
  • makes it near-impossible to reason about time in other parts of the world
  • does not mean everybody gets up at the same time, goes to work at the same time, or goes to bed at the same time
  • is not simpler.

As long as humans live in more than one part of the world, solar time is always going to be subjective. Abolishing time zones only exacerbates this problem.

[–] [email protected] 17 points 5 months ago (2 children)

Timezones make intuitive sense for humans

UTC / Unix timestamps make intuitive sense for computers

The issue is bridging the gap

load more comments (2 replies)
load more comments (7 replies)
[–] [email protected] 59 points 5 months ago (1 children)

You know the system before timezones was way worse, right? Every town had their own time.

[–] Crisps 24 points 5 months ago

That problem happened because there was no way to travel from town to town quickly so if the clocks were off nobody cared. The trains changed that.

[–] [email protected] 56 points 5 months ago (4 children)

I used to think this way, then it was pointed out to me that, without timezones, we'd be in a situation where Saturday starts mid-workday in some places.

[–] bassomitron 44 points 5 months ago (13 children)

Yeah, timezones are absolutely helpful from a logistics and coordination standpoint. Daylight savings time, though... That nonsense needs to be eliminated. So what if it will be dark well into morning wake hours in the winter, I'd take it over dealing with the time change twice a year.

[–] Cipher22 12 points 5 months ago* (last edited 5 months ago) (6 children)

Anti-DST... The almost accidental political bridge. Kinda funny actually: https://www.reuters.com/world/us/us-senate-approves-bill-that-would-make-daylight-savings-time-permanent-2023-2022-03-15/

Look at the names of the quotes. Both sides are commenting on how dumb it is.

Then the House got involved.

load more comments (6 replies)
load more comments (12 replies)
load more comments (3 replies)
[–] tibi 38 points 5 months ago* (last edited 5 months ago) (1 children)

It could have been worse. The romans had the day divided into 24 hours, like we do, but the hours varied in length so that from sunrise to sunset, you would always have 12 hours.

Imagine if that was the agreed upon time system, and we had to program that into computers.

[–] SkunkWorkz 16 points 5 months ago

It’s called temporal hour. Many cultures around the world had such a time system. Like in Japan they made clocks and watches that could tell temporal hours called wadokei.

[–] [email protected] 32 points 5 months ago (3 children)

fr i keep saying this and nobody seems to think it's a good idea.

Fuck timezones, me and my homies operate on UTC.

[–] [email protected] 37 points 5 months ago (6 children)

UTC is timezone too. It has leap seconds. IAT is atomic time. It is perfect.

[–] [email protected] 29 points 5 months ago (2 children)

I say we ditch this nonsense altogether and go back to vague descriptions of the Sun's position in the sky.

load more comments (2 replies)
load more comments (5 replies)
[–] Sunrosa 19 points 5 months ago* (last edited 5 months ago) (3 children)

Ive been using utc personally for over a year and i use it in context of vrchat since it yields one less necessary conversion to other people's timezones because only the offset is needed (as opposed to memorizing both offsets, which is much harder because of that nasty nasty daylight savings and its weird anomalies) but they still hate it and tell me to use a "normal" timezone lol. I had gotten 1 person to switch. And she since switched back. Shit don't work in practicality but I'm still gonna use it out of stubbornness

[–] [email protected] 10 points 5 months ago

Go play EVE Online. The servers used to have (still, do I think, but shorter) daily downtime that was scheduled using UTC and it led to everyone using UTC since the game server itself used that time.

load more comments (2 replies)
[–] Hasherm0n 8 points 5 months ago

One of my favorite T-shirts. https://www.teepublic.com/t-shirt/23763923-utc-or-gtfo

(I am not affiliated in any way with this shop)

[–] [email protected] 31 points 5 months ago (4 children)

Timezones are fine to program around.
DST is a bit of a pickle to plan around, but can be done just fine by a computer program.

Historical dates; considering leap years, skipped leap years, and times when leap years weren't a thing or when humanity just decided we skip a bunch of years; are the bane of all that is good.

load more comments (4 replies)
[–] Ziglin 31 points 5 months ago (2 children)

You've got make sure you program the time machine correctly though…

load more comments (2 replies)
[–] [email protected] 28 points 5 months ago (1 children)

Timezones are kind of a necessary evil though, because without them then you'd have to check regions (or zones) to see if 1PM in China is the same thing as 1PM in Australia is the same thing as 1PM in Bolivia.

load more comments (1 replies)
[–] [email protected] 22 points 5 months ago (8 children)

Aren't time zones quite straightforward? You add a whole number of hours and for some a half. Compare that to a sundial on the one side and having times that don't match your day at all on the other, I'd say it's good

[–] [email protected] 27 points 5 months ago (8 children)

You add a whole number of hours and for some a half

Or three quarters in a few cases.

And of course there are cases where countries spanning as many as 5 "ideal" time zones (dividing the globe into 24 equal slices) actually use a single time zone.

And then when someone tells you the meeting is at 10:00 am, you have to figure out if they mean your time zone or theirs, and if they mean theirs, you then have to convert that to yours. Oh, but your conversion was wrong because one of you went into or out of daylight saving time between the day when you did the conversion and when the meeting took place.

load more comments (8 replies)
[–] Skullgrid 10 points 5 months ago (1 children)

you have to program a meeting that reoccurs between DST observant & non observant states in the US and australia.

Good luck.

load more comments (1 replies)
[–] [email protected] 8 points 5 months ago (1 children)

It's not always whole hours

[–] [email protected] 9 points 5 months ago

To be fair, they did say "and for some a half".

Though that misses the Kathmandu, Eucla, and Chatham Islands, which are all :45.

load more comments (5 replies)
[–] [email protected] 21 points 5 months ago (2 children)

Inagine going back hundreds of years to convince everybody in the world to use the same time. "No I know not everybody has a clock, but if you could consider sunrise midday that would make my job in the future much easier."

load more comments (2 replies)
[–] [email protected] 17 points 5 months ago (5 children)

It’s only bad when used incorrectly. Just store time in UTC and convert it to timezone of your setting to present it. Most modern languages offer a library that makes it just one more line of code. Not only it’s then clear and unambiguous, it supports all timezones.

load more comments (5 replies)
[–] [email protected] 14 points 5 months ago (1 children)

At least most of us don't need to worry about time dilation caused by relatively yet. Have fun with that, space faring developers.

load more comments (1 replies)
[–] veganpizza69 12 points 5 months ago (2 children)

I fucking hate timezones. Whatever it is, I'd rather read the current clock as 4 a.m. even if it's noon than have timezones.

[–] [email protected] 20 points 5 months ago (1 children)

Only freaks have AM/PM in their time system.

[–] [email protected] 22 points 5 months ago

24hr clock supremacy

[–] [email protected] 8 points 5 months ago (1 children)

Well you can. Just switch your clock to UTC and you're done. You won't even have DST to deal with.

load more comments (1 replies)
[–] [email protected] 11 points 5 months ago* (last edited 5 months ago)

Dates and times aren't that hard—honestly!

Video is a lecture about how to think about dates and times, through the lens of a specific open source .NET library designed to aid with applying that thinking. It points out how most languages' standard libraries really work against you, because they conflate different concepts. For example, an Instant (a specific point in time, globally recognised) and a LocalDateTime (a date and time in a way that is irrespective of your location—for example you might want your alarm to wake you at 8:00 am on weekdays, and still do that if you move to a different time zone), a ZonedDateTime (a date and time tied to a specific location—like if you want to say "the meeting starts at 10:00 am Oslo Time"), and an OffsetDateTime (a date and time tied to a specific UTC offset—which is not necessarily the same as a time zone, because "Oslo Time" is a time zone that doesn't change, but its UTC offset might change if they go in or out of DST, or if a place decides to change, like how Samoa changed from UTC-11 to UTC+13 in 2011.

These are all subtly different concepts which are useful in different cases, but most libraries force you to use a single poorly-defined "DateTime" class. It's easier and requires less thought, but is also much more likely to get you into trouble as a result, precisely because of that lack of thought, because it doesn't let you make a clear distinction about what specifically it is.

His library is great for this, but it's very worth thinking about what he's talking about even if you don't or can't use it. As he says in wrapping up:

You may be stuck using poor frameworks, but you don't have to be stuck using poor concepts. You can think of the bigger concepts and represent all the bits without having to write your own framework, without having to do all kinds of stuff, just be really, really clear in all your comments and documentation.

[–] [email protected] 9 points 5 months ago* (last edited 5 months ago)

The notifications in one of our systems is aligned with UTC because it needs to be for a whole bunch of background services to function. Periodically (every couple of years) someone raises a ticket to complain that the time of their notifications is an hour out, and the 2nd line support worker will think "well that's easy, I'll just change the server time to BST". This then brings this whole suite of applications to a crashing halt as everything fails.

[–] [email protected] 9 points 5 months ago

Worst is when someone fucked up the DB time configs at some point and you have datetimes in a column that fall during the “nonexistent” hour in which clocks skip ahead for DST, and you have to figure out what the fuck actually happened there, and where in the data pipeline tz data was either added or stripped (sometimes it’s both, and sometimes it’s not just once), and undo the timestamp fuckery.

Source: did that this week. Was not super awesome.

load more comments
view more: next ›