Aug. 15, 2015
11:58 p.m.
random832@fastmail.us wrote:
strftime apparently has no trouble formatting a year of 2147485547 (2**31+1899) despite that being beyond the 32-bit limit.
tzcode strftime has special code to format years correctly even if tm_year + 1900 exceeds INT_MAX. See the _yconv code involving DIVISOR in strftime.c. As I understand it POSIX requires this sort of thing. That is, although POSIX doesn't require support for UTC years before 1970, POSIX does require that localtime and strftime support UTC years through INT_MAX + 1900 if time_t is wide enough (e.g., the common case of 64-bit time_t and 32-bit int).