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.]

123 points
*

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.

permalink
report
reply
50 points

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

permalink
report
parent
reply
51 points
*

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

permalink
report
parent
reply
20 points

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

permalink
report
parent
reply
3 points

I love the word “Epochalypse”, from the wiki page you linked

permalink
report
parent
reply
2 points

I thought that’s what datetime was based off of, tbh.

permalink
report
parent
reply
1 point

I know, but it’s not standard anywhere in the world.

permalink
report
parent
reply
5 points

Give it a few more decades

permalink
report
parent
reply
4 points

Swatch’s Internet Beats are making more and sense every time Daylight Savings forces a timezones change. Why are we still using base 12 for time anyway?

permalink
report
parent
reply
67 points

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.

permalink
report
reply
51 points

Without considering this, most people wouldn’t be able to drive anywhere they haven’t been before anymore.

permalink
report
parent
reply
14 points

“Wouldn’t be able to” is a bit of a stretch, since Thomas Maps existed long before GPS. But it wouldn’t be so easy as it is now.

permalink
report
parent
reply
10 points

Most people couldn’t use a Thomas guide in the mid 90s either.

permalink
report
parent
reply
54 points
13 points

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

permalink
report
parent
reply
8 points

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

permalink
report
parent
reply
8 points

I thought it is about when Julian calendar was dropped in favour of Gregorian, but that’s not it:

Thursday 4 October 1582 was followed by Friday 15 October 1582

permalink
report
parent
reply
4 points

Epoch is your friend, or use UTC. At least that’s my layman reasoning. I have no challenges working with DateTime except when I don’t know the underlying conditions applied from the source code.

permalink
report
parent
reply
10 points

I really wish that list would include some explanations about why each line is a falsehood, and what’s actually true. Particularly the line:

The software will never run on a space ship that is orbiting a black hole.

If the author has proof that some software will run on a space ship that is orbiting a black hole, I’d be really interested in seeing it.

permalink
report
parent
reply
12 points

Technically isn’t the Earth itself a sort of space ship which is orbiting (…a star which is orbiting…) the black hole at the center of the Milky Way galaxy? Not really close enough for time dilation to be a factor, but still.

permalink
report
parent
reply
7 points

All links to the original article are dead and even archive.org doesn’t have a capture either. I guess the argument is along the lines of “it might not be relevant, when you’re scripting away some tasks for your small personal projects, but when you’re working on a widely used library or tool - one day, it might end up on a space vessel to explore whatever.”

E.g. my personal backup script? Unlikely. The Linux kernel? Somewhat plausible.

permalink
report
parent
reply
2 points

It’s a programmer thing. As you’re typing the code, you may suddenly realize that the program needs to a assume certain things to work properly. You could assume that time runs at a normal rate as opposed to something completely wild when traveling close to the speed of light or when orbiting a black hole.

In order to keep the already way too messy code reasonably simple, you decide that the program assumes you’re on Earth. You leave a comment in the relevant part of the code saying that this part shouldn’t break as long as you’re not doing anything too extreme.

permalink
report
parent
reply
2 points
*

Well in a very strict sense one can’t really say “never” (unless you can see into the Future), but it’s probably safe to go along with “It’s highly unlikelly and if it does happen I’ll fix it or will be long dead so won’t care”.

permalink
report
parent
reply
10 points

This one is good (or evil, depends on how you see it):

Human-readable dates can be specified in universally understood formats such as 05/07/11.

permalink
report
parent
reply
9 points

That one’s really good.

Which one is it?

  • July 5th 2011
  • May 7th 2011
  • July 11th 2005
  • November 7th 2005

And is it 2011/2005 or rather 1911/1905, 1811/1805,…?

permalink
report
parent
reply
8 points

Does anyone know what is untrue about “Unix time is the number of seconds since Jan 1st 1970.”?

permalink
report
parent
reply
28 points
*

When a leap second happens, unix time decreases by one second. See the section about leap seconds here: https://en.m.wikipedia.org/wiki/Unix_time

As a side effect, this means some unix timestamps are ambiguous, because the timestamps at the beginning and the end of a leap second are the same.

permalink
report
parent
reply
4 points

It might be more accurate to say that Unix time is the number of days since Jan 1st, 1970, scaled by 24×60×60. Though it gets a bit odd around the actual leap second since they aren’t spread over the whole day. (In some ways that would be a more reasonable way to handle it; rather than repeating a second at midnight, just make all the seconds slightly longer that day.)

permalink
report
parent
reply
3 points

This post made my head hurt

permalink
report
parent
reply
49 points

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

permalink
report
reply
19 points

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

permalink
report
parent
reply
15 points
4 points

Holy crap I wasn’t ready for that. Great rec tho

permalink
report
parent
reply

Really good, thanks

permalink
report
parent
reply
1 point
*
SPOILER

I want little Emily to change her future. A sequel is needed!

(Thanks for sharing, was a good watch.)

permalink
report
parent
reply
5 points
*

Then there’s continental drift, which as Indiana Jones reminded us this past summer, Archimedes didn’t know about when he built his time machine.

Pet peeve: brushing aside the time travel fantasy element, there is not a single shred of evidence of any type of connection between Archimedes and the Antikythera Mechanism.

As if the only person clever enough in Ancient Greece was that one famous dude from Syracuse.
Ionians: “Are we a joke to you?”

permalink
report
parent
reply
1 point
*

Could you eli5 what frame and epoch are? I don’t get why aren’t unix timestamps an adequate way to store time, they seem pretty easy and intuitive

permalink
report
parent
reply
35 points
*

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.

permalink
report
reply
13 points

Using YearMonth.atEndOfMonth would have been the easier choice there, I think

permalink
report
parent
reply
15 points

holy shit, yeah it would have. tyvm, I’ll be putting in a PR first thing monday!

permalink
report
parent
reply
5 points

Would you mind trying to explain (ELI5 style) what you did before and why you are excited for this new method for those of us who dont understand code?

permalink
report
parent
reply
8 points

In the example you gave, wouldn’t the year be off by one when param2.month is 12?

permalink
report
parent
reply
9 points

I was transcribing it from memory and that exact problem cost me like two hours when I was writing it the first time. Well spotted, now write me a unit test for that case.

permalink
report
parent
reply
2 points

Y’know, I legitimately said to myself “I bet they were writing that from memory and just forgot the edge case. I wonder if that was a problem when doing it originally?” before I wrote that comment. 😂 Time to get some Spock tests set up!

permalink
report
parent
reply
4 points

Unix epoch time in UTC, making sure that your local offset and drift are current at the time of conversion to UTC…

permalink
report
parent
reply
2 points

i don’t even care if its wrong, I just want the code to be readable.

permalink
report
parent
reply
2 points

You should care if it’s wrong.

permalink
report
parent
reply
2 points

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.

permalink
report
parent
reply
2 points

All dates and times shall be stored and manipulated in Unix time. Only convert to a readable format at the top of the UI, and forget trying to parse user inputs :P that’s just impossible

permalink
report
parent
reply
3 points

I picture this being read by the fred armisen “believe it or not, straight to jail” character

permalink
report
parent
reply

xkcd

!xkcd@lemmy.world

Create post

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

Community stats

  • 1.7K

    Monthly active users

  • 258

    Posts

  • 5.8K

    Comments

Community moderators