mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Optimize unix timestamp to date-string conversion for very high year values
This commit is contained in:
parent
09d73b67e2
commit
02bdb521e2
@ -55,6 +55,12 @@ void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts)
|
||||
|
||||
if (ts >= 0) {
|
||||
tmp_days = days + 1;
|
||||
|
||||
if (tmp_days >= DAYS_PER_LYEAR_PERIOD || tmp_days <= -DAYS_PER_LYEAR_PERIOD) {
|
||||
cur_year += YEARS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
|
||||
tmp_days -= DAYS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
|
||||
}
|
||||
|
||||
while (tmp_days >= DAYS_PER_LYEAR) {
|
||||
cur_year++;
|
||||
if (timelib_is_leap(cur_year)) {
|
||||
|
Loading…
Reference in New Issue
Block a user