Fix bug related with datetime conversion. Contributed by Thomas.

This commit is contained in:
Vreixo Formoso 2008-01-22 22:24:44 +01:00
parent 164e97f6bc
commit ae679b0f61

View File

@ -986,7 +986,7 @@ void iso_datetime_7(unsigned char *buf, time_t t)
#ifdef HAVE_TM_GMTOFF #ifdef HAVE_TM_GMTOFF
tzoffset = tm.tm_gmtoff / 60 / 15; tzoffset = tm.tm_gmtoff / 60 / 15;
#else #else
tzoffset = timezone / 60 / 15; tzoffset = ( - timezone / 60 / 15 ) + 4 * tm.tm_isdst;
#endif #endif
if (tzoffset > 52) if (tzoffset > 52)
tzoffset -= 101; tzoffset -= 101;
@ -1021,7 +1021,7 @@ void iso_datetime_17(unsigned char *buf, time_t t)
#ifdef HAVE_TM_GMTOFF #ifdef HAVE_TM_GMTOFF
tzoffset = tm.tm_gmtoff / 60 / 15; tzoffset = tm.tm_gmtoff / 60 / 15;
#else #else
tzoffset = timezone / 60 / 15; tzoffset = ( - timezone / 60 / 15 ) + 4 * tm.tm_isdst;
#endif #endif
if (tzoffset > 52) if (tzoffset > 52)
tzoffset -= 101; tzoffset -= 101;
@ -1055,7 +1055,7 @@ time_t iso_datetime_read_17(const uint8_t *buf)
tm.tm_year -= 1900; tm.tm_year -= 1900;
tm.tm_mon -= 1; tm.tm_mon -= 1;
return timegm(&tm) - buf[16] * 60 * 15; return timegm(&tm) - ((int8_t)buf[6]) * 60 * 15;
} }
/** /**