One more tweak to the get_date_time function (Issue #115)

This commit is contained in:
Michael R Sweet 2025-04-07 08:20:08 -04:00
parent 7afefda326
commit d7eb1fc540
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244

View File

@ -870,9 +870,15 @@ get_date_time(const char *s) // I - PDF date/time value
return (0);
# if defined(HAVE_TM_GMTOFF)
// Adjust the time value using the "tm_gmtoff" and "tm_isdst" members. As
// noted by M-HT on Github, this DST hack will fail in timezones where the
// DST offset is not one hour, such as Australia/Lord_Howe. Fortunately,
// this is unusual and most systems support the "timegm" function...
t += dateval.tm_gmtoff - 3600 * dateval.tm_isdst;
# else
t += timezone - 3600 * dateval.tm_isdst;
// Adjust the time value using the even more legacy "timezone" variable,
// which also reflects any DST offset...
t += timezone;
# endif // HAVE_TM_GMTOFF
#endif // _WIN32