Earlier quoted context omitted.
not completely coincidentally, March was also the first month of the year in many historical calendars. Afaik that also explains why the month names have offset to them (sept, oct, nov, dec) edit: I just love that there are like 5 different comments pointing out this same thing
I've read that not only March was the first month, but the number of months was only ten: winter months did not need to be counted because there was no agricultural work to be done (which was the primary purpose of the calendar). So after the tenth month there was a strange unmapped period.
A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
61–70 of 100 posts
Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#62Earlier quoted context omitted.
I thought Sept, Oct, Nov, and Dec were shifted by the addition of July (Julius) and August (Augustus)?
That's a common misconception. Those were just renamed for the Caesars. January and February we added, before that there was just a gap in the winter.
Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#63 const C1 = 505054698555331 // floor(2^64*4/146097)
as constexpr int C1 = floor(2^64*4/146097);Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#64Earlier quoted context omitted.
IIRC, it's also why the leap day was set to Feb 29th in the first place. At the time (romans?) the year started March 1st. In case someone was wondering why in the world someone said we should add a day to the second month of the year...
The calendar was regularized to include a leap day during the reign of Julius Caesar (hence the name "Julian calendar"), which would have been 45 BC. The Roman calendar moved to January as the first month of the year in 153 BC, over a hundred years before the leap day was added. The 10-month calendar may not have even existed--we see no contemporary evidence of its existence, only reports of its existence from centur…
It's fair to say January was the first month of the Roman calendar; despite it having formerly been March.
Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#65TIL that Unix Time does not count leap seconds. If it did, it wouldn't have been possible to write routines that are this fast.
Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#66Perhaps nicer to avoid the comment and write: const C1 = 505054698555331 // floor(2^64*4/146097) as constexpr int C1 = floor(2^64*4/146097);
Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#67Earlier quoted context omitted.
I've read that not only March was the first month, but the number of months was only ten: winter months did not need to be counted because there was no agricultural work to be done (which was the primary purpose of the calendar). So after the tenth month there was a strange unmapped period.
How do you figure out it's March 1 if you're not counting days?
Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#68Earlier quoted context omitted.
IIRC, it's also why the leap day was set to Feb 29th in the first place. At the time (romans?) the year started March 1st. In case someone was wondering why in the world someone said we should add a day to the second month of the year...
The calendar was regularized to include a leap day during the reign of Julius Caesar (hence the name "Julian calendar"), which would have been 45 BC. The Roman calendar moved to January as the first month of the year in 153 BC, over a hundred years before the leap day was added. The 10-month calendar may not have even existed--we see no contemporary evidence of its existence, only reports of its existence from centur…
Caesar happened to be the Pontifex Maximus (an office you hold for life once elected to), but he wasn't in Rome much to do that job. So after he came back from hanging out with Cleopatra in Egypt he came back and set the calendar on auto-pilot.
Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#69Perhaps nicer to avoid the comment and write: const C1 = 505054698555331 // floor(2^64*4/146097) as constexpr int C1 = floor(2^64*4/146097);
std::floor was made constexpr in C++23, which is pretty recent as far as C++ standards go. It's possible the author didn't think using C++23 was worth the constraints it places on who could use the code.
Re: A Fast 64-Bit Date Algorithm (30–40% faster by counting dates backwards)
#70Earlier quoted context omitted.
Wouldn’t it be accurate for that as well? Unless we change to base 10 time units or something. Then we all have a lot of work to do. But if it’s just about starting over from 0 being the AI apocalypse or something, I’m sure it’ll be more manageable, and the fix could hopefully be done on a cave wall using a flint spear tip.
Or set 0 to be the Big Bang and make the type unsigned. Do it the same time we convert all temperature readings to Kelvin.