With tm_year being a signed 32-bit int, the maximum date I should be able to represent ought to be Wed Dec 31 23:59:59 UTC 2147485547 which is epoch 67768036191676799. This works on Linux and NetBSD, for example, as well as macOS. On FreeBSD 13.1R, however, it does not: $ date -r 67768036191676799 date: invalid time $ date -r 67767976233532799 Tue Dec 31 23:59:59 UTC 2147483647 $ date -r 67767976233532800 date: invalid time Note that here the maximum value (epoch 67767976233532799) is in the year 2147483647, not in the year 2147485547. The difference between the two is 1900, suggesting that FreeBSD somehow counts tm_year as starting at the year 0, not 1900. However, I can't identify where/when that is the case, as other dates correctly display tm_year as "year - 1900": struct tm *t; time_t now = time(NULL); t = gmtime(&now); printf("%s%ld %d\n", ctime(&now), now, t->tm_year); => Sat Oct 22 03:06:43 2022 1666408003 122 It's unclear to me why FreeBSD then can't represent 67768036191676799.
I believe this has been fixed upstream in more recent tzcode releases. The tzcode in FreeBSD has languished since approximately 2010. I have about 80% of an import to a more recent version done ... the easy 80% ... the more difficult 80% is taking forever.
^Triage: most likely fixed by or before rG75411d157232: Update tzcode to 2023c Apr 26 2023.