diff libpurple/util.c @ 21612:18fb032a602a

Fix the bug in purple_str_to_time() that was causing 'make check' to fail. Also fix the test value that 'make check' was using. that didn't help ;-)
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 22 Nov 2007 16:37:08 +0000
parents 87387eac4348
children 31101e7d275f
line wrap: on
line diff
--- a/libpurple/util.c	Thu Nov 22 16:32:56 2007 +0000
+++ b/libpurple/util.c	Thu Nov 22 16:37:08 2007 +0000
@@ -837,7 +837,19 @@
 			}
 			else if (utc)
 			{
-				t->tm_isdst = -1;
+				struct tm *tmptm;
+				time_t tmp;
+				tmp = mktime(t);
+				/* we care about whether it *was* dst, and the offset, here on this
+				 * date, not whether we are currently observing dst locally *now*.
+				 * This isn't perfect, because we would need to know in advance the
+				 * offset we are trying to work out in advance to be sure this
+				 * works for times around dst transitions but it'll have to do. */
+				tmptm = localtime(&tmp);
+				t->tm_isdst = tmptm->tm_isdst;
+#ifdef HAVE_TM_GMTOFF
+				t->tm_gmtoff = tmptm->tm_gmtoff;
+#endif
 			}
 
 			if (rest != NULL && *c != '\0')