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.]
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.
This is why we should just move to a universal time zone and stop with the day light savings.
We have that, it’s called Unix time, and the only thing it doesn’t account for is time dilation due to relativity.
If your system hasn’t been upgraded to 64-bit types by 2038, you’d deserve your overflow bug
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 AES25664 bits is already enough not to overflow for 292 billion years. That’s 21 times longer than the estimated age of the universe.
Thank you, but I gave up halfway through the list.
I got to “The day before Saturday is always Friday” and I was like waaaa?
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.
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.
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.
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
C++ user with operator overloading: “T2 minus T1.”
Let someone else implement the class. There’s probably a library for it.
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?
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
I recall a short story like that where someone died because they time traveled, but didn’t account for position.