Hello all,
the attached patch does what it says in the title. Please review, if accepted, please apply, otherwise, please tell me why not. Some people may rely on PdfDate not supporting DST. Best regards, mabri
Getting rid of non-standard Win32 specifics for timezone (AFAIK bug-compatible) Index: src/base/PdfDate.cpp =================================================================== --- src/base/PdfDate.cpp (revision 1680) +++ src/base/PdfDate.cpp (working copy) @@ -154,10 +154,14 @@ #ifdef _WIN32 // On win32, strftime with %z returns a verbose time zone name - // like "W. Australia Standard time". We use tzset and timezone + // like "W. Australia Standard time". We use time/gmtime/mktime // instead. - _tzset(); - snprintf( szZone, ZONE_STRING_SIZE, "%+03d", -_timezone/3600 ); + time_t cur_time = time( NULL ); + struct tm* cur_gmt = gmtime( &cur_time ); + // assumes _timezone cannot include DST (mabri: documentation unclear IMHO) + + time_t time_off = cur_time - mktime( cur_gmt ); // interpreted as local + snprintf( szZone, ZONE_STRING_SIZE, "%+03ld", time_off/3600 ); #else if( strftime( szZone, ZONE_STRING_SIZE, "%z", stm ) == 0 ) {
------------------------------------------------------------------------------
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users