I know it’s OS dependent thing, but I feel like many people here could help me to understand it better.
The thing is that calendar:universal_time_to_system_time({{1902,01,01}, {0,0,0}}) returns a valid result, but calendar:universal_time_to_system_time({{1901,12,31}, {23, 59,59}} (and all universal times below that) throws badarg with not a valid universal time.
Why is year 1902 a limit? Can that be configured somehow?
Sorry, but I made a mistake in the original post. It’s not universal_time_to_system_time, but universal_time_to_local_time…
What may be the clue is that if calendar:universal_time_to_system_time({{1902,01,01}, {0,0,0}}) returns -2145916800 which is just slightly below minimal signed int32…
/* This is the earliest year we are sure to be able to handle
on all platforms w/o problems */
#define BASEYEAR 1902
if (!(IN_RANGE(BASEYEAR, *year, INT_MAX - 1) &&
That’s interesting, seems like 32 bits when converting to seconds is not a limit because year can e.g. be 10000 which is out out of 32 bits when converted to seconds.
This was introduced 14 years ago with no information on why exactly that year is chosen…