Ahmed FASIH is a user on octodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Ahmed FASIH @22

Bit concerned that ISO dates have only four-digit years. Should I manually prepend two or three zeros to my ISO timestamps?

· Web · 0 · 0

@22 in year 9999 either your software will be entirely forgotten or you'll have had 8000 years to find a solution and implement it

@CobaltVelvet True. I’m old enough to remember the Y2K scramble and had colleagues who actually worked on that—it wasn’t fun and you know what they say—millennia of coding can save a few minutes thinking 😂.

@22 I once wrote a time calculation library which had leap year <=> y % 4 == 0
With the notice : "this library is valid from March 1st 1900 to Feb 28th 2100"
Was accepted by the QA guy.

@R1Rail Thanks you’ve inspired me. I’ll just store 64-bit integers—should still sort nicely under lexicographic ordering.

@22 I think they allow extended years, but only by prior negotiation of digit count (sensible but not amazing). I say adding two has a higher chance of being a Schelling point than adding three, since 2 → 4 → 6 feels more symmetrical than 2 → 4 → 7, though adding one at a time is even more likely.

@22 tools.ietf.org/html/rfc2550 (April 1 RFC) §3.4.2.4 has a different idea about how to deal with Y10K, one which I actually like at first glance.

@22 I'm sure there's plenty of position-dependent code that could still break, but at least 2099 isn't ambiguous the way '99 would be.

To clarify, I’m using one of these NoSQL databases whose idea of sorting is limited to lexicographic sort (i.e., stringy sort: leveldb, CouchDB). I use ISO-formatted timestamps—“2017-07-03T17:48:12.857Z”—as part of the stringy key to get temporal sorting, but naturally this will break in the year 10k of the Common Era, since `10000-01-01T…` sorts before `9999-12-12T…` (or `2017-07-03T…` for that matter).

Lexicographic sorting, ladies and gents…

Thanks to @dasyatidprime’s pointer to tools.ietf.org/html/rfc2550 (section 3) the solution has already been described. Year 10K will be stringified as A10000. Year 100K as "B100000". And so on.

Problem solved. Moving on. Nothing more left to see.

@22 Now you just have to make sure someone actually implements that in the relevant software within the next few thousand years, and you're good. :-) (I'm leaving an additional several thousand years for proper deployment and integration testing, of course…)