From 7ea6d4ebcbf6e01f98cccdbcf92fbd9fa129506f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 28 Nov 2014 12:08:21 +0100 Subject: [PATCH] Forced ECMA-119 timestamp generation to GMT if no timezone info is available. --- libisofs/util.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libisofs/util.c b/libisofs/util.c index 2257a9d..cd62b12 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -1577,8 +1577,11 @@ void iso_datetime_7(unsigned char *buf, time_t t, int always_gmt) #ifndef Libburnia_timezonE #define Libburnia_timezonE timezone #endif + #if Libburnia_timezonE == 0 + always_gmt = 1; + #endif tzoffset = ( - Libburnia_timezonE / 60 / 15 ) + 4 * tm.tm_isdst; -#endif +#endif /* ! HAVE_TM_GMTOFF */ if (tzoffset > 52 || tzoffset < -48 || always_gmt) { /* absurd timezone offset, represent time in GMT */ @@ -1623,8 +1626,14 @@ void iso_datetime_17(unsigned char *buf, time_t t, int always_gmt) #else if (tm.tm_isdst < 0) tm.tm_isdst = 0; - tzoffset = ( - timezone / 60 / 15 ) + 4 * tm.tm_isdst; +#ifndef Libburnia_timezonE +#define Libburnia_timezonE timezone #endif + #if Libburnia_timezonE == 0 + always_gmt = 1; + #endif + tzoffset = ( - Libburnia_timezonE / 60 / 15 ) + 4 * tm.tm_isdst; +#endif /* ! HAVE_TM_GMTOFF */ if (tzoffset > 52 || tzoffset < -48 || always_gmt) { /* absurd timezone offset, represent time in GMT */