diff options
author | Derick Rethans <github@derickrethans.nl> | 2017-08-15 15:06:18 +0100 |
---|---|---|
committer | Derick Rethans <github@derickrethans.nl> | 2017-08-15 15:06:18 +0100 |
commit | 584db6f38fcac3e5e1ca4c770d3aacfff09ee371 (patch) | |
tree | 5223b28c60a05d7870ea2d76b7bdbd84bcf0b2d8 /ext/date/lib/unixtime2tm.c | |
parent | 3bc12268041bdeec9941c99f08b71620f7572eb0 (diff) | |
download | php-git-584db6f38fcac3e5e1ca4c770d3aacfff09ee371.tar.gz |
Merged PHP-7.0 by hand due to conflicts.
Diffstat (limited to 'ext/date/lib/unixtime2tm.c')
-rw-r--r-- | ext/date/lib/unixtime2tm.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/ext/date/lib/unixtime2tm.c b/ext/date/lib/unixtime2tm.c index e46a0af57d..43bfe818f5 100644 --- a/ext/date/lib/unixtime2tm.c +++ b/ext/date/lib/unixtime2tm.c @@ -23,18 +23,7 @@ */ #include "timelib.h" - -#include <stdio.h> - -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#ifdef HAVE_STRING_H -#include <string.h> -#else -#include <strings.h> -#endif +#include "timelib_private.h" static int month_tab_leap[12] = { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; @@ -60,7 +49,7 @@ 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) { + 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); } @@ -149,7 +138,7 @@ void timelib_update_from_sse(timelib_time *tm) switch (tm->zone_type) { case TIMELIB_ZONETYPE_ABBR: case TIMELIB_ZONETYPE_OFFSET: { - timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + (tm->dst * 3600)); + timelib_unixtime2gmt(tm, tm->sse + tm->z + (tm->dst * 3600)); goto cleanup; } @@ -187,7 +176,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts) int z = tm->z; signed int dst = tm->dst; - timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600)); + timelib_unixtime2gmt(tm, ts + tm->z + (tm->dst * 3600)); tm->sse = ts; tm->z = z; @@ -295,10 +284,3 @@ int timelib_apply_localtime(timelib_time *t, unsigned int localtime) } return 0; } - -#if HAVE_GETTIMEOFDAY -void timelib_set_fraction_from_timeval(timelib_time *t, struct timeval tp) -{ - t->f = (double) tp.tv_usec / 1000000; -} -#endif |