summaryrefslogtreecommitdiff
path: root/time/win32
diff options
context:
space:
mode:
authorBranko Čibej <brane@apache.org>2002-06-09 20:25:51 +0000
committerBranko Čibej <brane@apache.org>2002-06-09 20:25:51 +0000
commit66e55d240fee7dfc8e8f0ec9a23bd650c282cb96 (patch)
tree1ab0777676e1cfbdd00624b850ec8d8b6f7f3e66 /time/win32
parent523448fc9a8d67e3d2c1c96b7d79c11bfdabdc13 (diff)
downloadapr-66e55d240fee7dfc8e8f0ec9a23bd650c282cb96.tar.gz
Fix calculation of tm_gmtoff on Windows, and add a test case.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63485 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'time/win32')
-rw-r--r--time/win32/time.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/time/win32/time.c b/time/win32/time.c
index d10935829..672b683cf 100644
--- a/time/win32/time.c
+++ b/time/win32/time.c
@@ -105,16 +105,19 @@ static void SystemTimeToAprExpTime(apr_time_exp_t *xt, SYSTEMTIME *tm, BOOL lt)
rc = GetTimeZoneInformation(&tz);
switch (rc) {
case TIME_ZONE_ID_UNKNOWN:
- case TIME_ZONE_ID_STANDARD:
xt->tm_isdst = 0;
/* Bias = UTC - local time in minutes
* tm_gmtoff is seconds east of UTC
*/
xt->tm_gmtoff = tz.Bias * -60;
break;
+ case TIME_ZONE_ID_STANDARD:
+ xt->tm_isdst = 0;
+ xt->tm_gmtoff = (tz.Bias + tz.StandardBias) * -60;
+ break;
case TIME_ZONE_ID_DAYLIGHT:
xt->tm_isdst = 1;
- xt->tm_gmtoff = tz.Bias * -60;
+ xt->tm_gmtoff = (tz.Bias + tz.DaylightBias) * -60;
break;
default:
xt->tm_isdst = 0;
@@ -224,8 +227,7 @@ APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *t,
{
apr_status_t status = apr_time_exp_get(t, xt);
if (status == APR_SUCCESS)
- *t -= (apr_time_t) (xt->tm_isdst * 3600
- + xt->tm_gmtoff) * APR_USEC_PER_SEC;
+ *t -= (apr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC;
return status;
}