pidgin: 5a4aad02: Fix purple_str_to_time() to not break th...
rlaager at pidgin.im
rlaager at pidgin.im
Sun May 11 01:10:45 EDT 2008
-----------------------------------------------------------------
Revision: 5a4aad0264b9a0daceb00f487909a348015ad3ad
Ancestor: e74f183a9d3d3dc37ee95c98cc5e665a10b41b31
Author: rlaager at pidgin.im
Date: 2008-05-11T04:50:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5a4aad0264b9a0daceb00f487909a348015ad3ad
Modified files:
libpurple/util.c
ChangeLog:
Fix purple_str_to_time() to not break the returned value when we have given
it a string with a GMT offset (like a log filename). We were setting
tm_isdst to 0 when we knew the offset. Apparently, mktime() said, "Umm,
yes, it is DST." and fixed it by shifting the hour. The fix is to tell
the C library (by setting tm_isdst to -1) that we're sure of the time, but
not the DST status. Hopefully this doesn't break any other code path.
Fixes #3550
-------------- next part --------------
============================================================
--- libpurple/util.c bd1efb88bba75a998861b7b3acea6a7c8e0aa8c1
+++ libpurple/util.c ee8596c994e8233744dcfdb9db06869b235412cb
@@ -831,9 +831,6 @@ purple_str_to_time(const char *timestamp
tzoff = tzhrs*60*60 + tzmins*60;
if (offset_positive)
tzoff *= -1;
- /* We don't want the C library doing DST calculations
- * if we know the UTC offset already. */
- t.tm_isdst = 0;
}
else if (utc)
{
@@ -895,14 +892,11 @@ purple_str_to_time(const char *timestamp
}
}
+ retval = mktime(&t);
+
if (tm != NULL)
- {
*tm = t;
- tm->tm_isdst = -1;
- mktime(tm);
- }
- retval = mktime(&t);
if (tzoff != PURPLE_NO_TZ_OFF)
retval += tzoff;
More information about the Commits
mailing list