libc: fix conversions of negative timestamps (eg., 0 in western timezones)

This commit is contained in:
K. Lange 2022-04-17 18:36:38 -04:00
parent 75c3ef88bb
commit 06f0c6f9cc

View File

@ -58,7 +58,7 @@ static struct tm * fill_time(const time_t * timep, struct tm * _timevalue, const
_timevalue->_tm_zone_name = tzName; _timevalue->_tm_zone_name = tzName;
_timevalue->_tm_zone_offset = tzOffset; _timevalue->_tm_zone_offset = tzOffset;
long seconds = 0; long seconds = timeVal < 0 ? -2208988800L : 0;
long year_sec = 0; long year_sec = 0;
int startYear = timeVal < 0 ? 1900 : 1970; int startYear = timeVal < 0 ? 1900 : 1970;