gmime r1537 - in trunk: . gmime



Author: fejj
Date: Thu Apr  2 02:00:17 2009
New Revision: 1537
URL: http://svn.gnome.org/viewvc/gmime?rev=1537&view=rev

Log:
2009-04-01  Jeffrey Stedfast  <fejj novell com>

	* gmime/gmime-utils.c: #include <process.h> for building on
	Windows.
	(mktime_utc): Use _get_timezone() when building on Windows.
	(g_mime_utils_header_format_date): Windows has gmtime_s() instead
	of gmtime_r(), so use that on Windows.



Modified:
   trunk/ChangeLog
   trunk/gmime/gmime-utils.c

Modified: trunk/gmime/gmime-utils.c
==============================================================================
--- trunk/gmime/gmime-utils.c	(original)
+++ trunk/gmime/gmime-utils.c	Thu Apr  2 02:00:17 2009
@@ -169,8 +169,10 @@
 	
 	date += ((tz_offset / 100) * (60 * 60)) + (tz_offset % 100) * 60;
 	
-#ifdef HAVE_GMTIME_R
+#if defined (HAVE_GMTIME_R)
 	gmtime_r (&date, &tm);
+#elif defined (HAVE_GMTIME_S)
+	gmtime_s (&tm, &date);
 #else
 	memcpy (&tm, gmtime (&date), sizeof (tm));
 #endif
@@ -440,28 +442,32 @@
 mktime_utc (struct tm *tm)
 {
 	time_t tt;
+	long tz;
 	
 	tm->tm_isdst = -1;
 	tt = mktime (tm);
 	
-#if defined (HAVE_TM_GMTOFF)
-	tt += tm->tm_gmtoff;
+#if defined (_WINDOWS)
+	_get_timezone (&tz);
+#elif defined (HAVE_TM_GMTOFF)
+	tz = -tm->tm_gmtoff;
 #elif defined (HAVE_TIMEZONE)
 	if (tm->tm_isdst > 0) {
 #if defined (HAVE_ALTZONE)
-		tt -= altzone;
+		tz = altzone;
 #else /* !defined (HAVE_ALTZONE) */
-		tt -= (timezone - 3600);
+		tz = (timezone - 3600);
 #endif
-	} else
-		tt -= timezone;
+	} else {
+		tz = timezone;
+	}
 #elif defined (HAVE__TIMEZONE)
-	tt -= _timezone;
+	tz = _timezone;
 #else
 #error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc.
 #endif
 	
-	return tt;
+	return tt - tz;
 }
 
 static time_t



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]