Reviewed by: Brian Behlendorf
Submitted by: Paul Eggert <eggert@twinsun.com> Fixes time zone problems. Old behavior: * When the time zone is not an integral multiple of 1 hour, the logs report bogus UTC offsets. E.g. if the time zone is +0530 the reported UTC offset is +051800. * If !defined(HAS_GMTOFF) && !defined(NO_TIMEZONE), when the daylight-saving offset is not exactly 1 hour, the logs compute the UTC offset incorrectly when daylight saving is in effect. * If !defined(HAS_GMTOFF) && defined(NO_TIMEZONE), the code invokes mktime twice, once on the output of localtime and once on the output of gmtime, and subtracts the results. This method is incorrect when the time is near a daylight-saving shift boundary. For example, suppose we are in US Pacific time and the current time is 1996-10-27 00:00:00 local time, just before a daylight saving time shift. The correct UTC offset is -0700, but in this case get_gmtoff incorrectly computes an offset of -0800, because mktime(gmtime(...)) applies mktime to `1996-10-27 07:00:00' (actually a UTC time, not a local time) and the UTC offset as of 1996-10-27 07:00:00 local time is -0800. Here is a patch. The key idea of the patch, which you'll find at the end, is an idea stolen from INN 1.5b1: assume that we are no more than 24 hours away from UTC, which is a reasonable assumption (among other things, Posix requires support only for -2400 through +2400 time zones) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@76978 13f79535-47bb-0310-9956-ffa450edef68
Please register or sign in to comment