this post was submitted on 14 Dec 2023
15 points (100.0% liked)

xkcd

8588 readers
21 users here now

A community for a webcomic of romance, sarcasm, math, and language.

founded 1 year ago
MODERATORS
 

https://xkcd.com/2867

Alt text:

It's not just time zones and leap seconds. SI seconds on Earth are slower because of relativity, so there are time standards for space stuff (TCB, TGC) that use faster SI seconds than UTC/Unix time. T2 - T1 = [God doesn't know and the Devil isn't telling.]

top 16 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 9 months ago* (last edited 9 months ago) (1 children)

I just spent two days debugging a reporting endpoint that takes in two MM-YYYY parameters and tries to pull info between the first day of the month for param1 and the last day of the month for param2 and ended up having to set my date boundaries as

LocalDate startDate = new LocalDate(1, param1.getMonth(), param2.getYear()); //pretty straightforward, right?

//bump month by one, account for rollover, set endDate to the first of that month, then subtract one day

int endMonth = param2.month == 12 ? param2.month + 1 : 1;

LocalDate endDate = new LocalDate(1, endMonth, param2.year).minusDays(1);

This is extraordinarily simply for humans to understand intuitively, but to code it requires accounting for a bunch of backward edge/corner case garbage. The answer, of course, is to train humans to think in Unix epoch time.

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

Unix epoch time is wrong too, as it doesn't include leap seconds, meaning your time difference will be off by up to 15 seconds.

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

C++ user with operator overloading: "T2 minus T1."

Let someone else implement the class. There's probably a library for it.

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

LOL whenever I have to work with DateTime systems that try to account for every possibility (and fail trying) I am reminded that in some disciplines, it's acceptable to simplify drastically in order to do 'close enough' work.

I mean, if spherical cows are a thing because that makes the math of theoretical physics doable, why not relativity-free or just frame-constant date-time measures that are willing to ignore exotic edge cases like non-spherical livestock?

[–] [email protected] 0 points 9 months ago (1 children)

Ah I've gotten to the point where I have to define what "frame" and epoch each time base is in before I'll touch the representation of time( Unix,Gregorian, etc) .To be honest I'm probably just scratching the surface of time problem.

Hell probably the reason we haven't seen time travellers is we suck at tracking time and you probably need to accurately know your time and place to a very good precision to travel to a given point and we can't say where and when that is with enough accuracy to facilitate where to land. And people don't want to land in the earth's surface or 10000 km away from a stable orbit. Maybe some writer can build that out for a time travel book or to discount it for some reason lol

[–] [email protected] -1 points 9 months ago

I recall a short story like that where someone died because they time traveled, but didn't account for position.

[–] [email protected] 2 points 9 months ago (1 children)
[–] [email protected] 1 points 9 months ago (1 children)

Thank you, but I gave up halfway through the list.

[–] [email protected] -1 points 9 months ago

I got to "The day before Saturday is always Friday" and I was like waaaa?

[–] [email protected] 2 points 9 months ago* (last edited 9 months ago) (1 children)

We use datediff in sql and let God handle the rest.

"Oh but they're in different time zones" "Oh did you account for if one is in day light savings and other isn't" "Aren't some of these dates stored in UTC and some local?"

Are all problems I do not care about.

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

This is why we should just move to a universal time zone and stop with the day light savings.

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

We have that, it's called Unix time, and the only thing it doesn't account for is time dilation due to relativity.

it's perfect

[–] [email protected] 2 points 9 months ago (1 children)

If your system hasn’t been upgraded to 64-bit types by 2038, you’d deserve your overflow bug

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

Let's just nake it 128-Bit so it's not our problem anymore.
Hell, let's make it 256-Bit because it sounds like AES256

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

64 bits is already enough not to overflow for 292 billion years. That’s 21 times longer than the estimated age of the universe.

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

From the wikipedia:

TCB ticks faster than clocks on the surface of the Earth by 1.550505 × 10−8 (about 490 milliseconds per year)

It's amazing that this level of detail is relevant to anything.