aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog9
-rw-r--r--camel/broken-date-parser.c10
-rw-r--r--camel/camel-mime-message.c18
-rw-r--r--camel/camel-mime-utils.c10
4 files changed, 18 insertions, 29 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index c362124039..f383b0dc8b 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,12 @@
+2002-09-04 Dan Winship <danw@ximian.com>
+
+ * camel-mime-utils.c (header_decode_date): Use e_mktime_utc.
+
+ * camel-mime-message.c (camel_mime_message_set_date): Use
+ e_localtime_with_offset.
+
+ * broken-date-parser.c (decode_broken_date): Use e_mktime_utc.
+
2002-09-04 Not Zed <NotZed@Ximian.com>
* tests/folder/test4.c (main): clear nonfatal stuff.
diff --git a/camel/broken-date-parser.c b/camel/broken-date-parser.c
index 7bcff0ffd4..cba19208b4 100644
--- a/camel/broken-date-parser.c
+++ b/camel/broken-date-parser.c
@@ -34,6 +34,7 @@
#include <time.h>
#include "broken-date-parser.h"
+#include "e-time-utils.h"
#define d(x) x
@@ -403,14 +404,7 @@ decode_broken_date (struct _date_token *tokens, int *tzone)
d(printf ("\n"));
- time = mktime (&tm);
-#if defined (HAVE_TIMEZONE)
- time -= timezone;
-#elif defined (HAVE_TM_GMTOFF)
- time += tm.tm_gmtoff;
-#else
-#error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc.
-#endif
+ time = e_mktime_utc (&tm);
/* t is now GMT of the time we want, but not offset by the timezone ... */
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 0b21d98a57..7f7a35466d 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -47,6 +47,8 @@
#include "camel-mime-filter-charset.h"
#include "camel-mime-filter-bestenc.h"
+#include "e-time-utils.h"
+
#define d(x)
/* these 2 below should be kept in sync */
@@ -202,22 +204,12 @@ camel_mime_message_set_date (CamelMimeMessage *message, time_t date, int offset
g_assert(message);
if (date == CAMEL_MESSAGE_DATE_CURRENT) {
- struct tm *local;
+ struct tm local;
int tz;
date = time(0);
- local = localtime(&date);
-#if defined(HAVE_TIMEZONE)
- tz = timezone;
-#elif defined(HAVE_TM_GMTOFF)
- tz = -local->tm_gmtoff;
-#endif
- offset = -(((tz/60/60) * 100) + (tz/60 % 60));
-#ifdef HAVE_TIMEZONE
- /* tm.tm_gmtoff is already adjusted for DST */
- if (local->tm_isdst>0)
- offset += 100;
-#endif
+ e_localtime_with_offset(date, &local, &tz);
+ offset = (((tz/60/60) * 100) + (tz/60 % 60));
}
message->date = date;
message->date_offset = offset;
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 3dc31f04d3..f1a3792f60 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -50,6 +50,7 @@
#include <glib.h>
#include <gal/unicode/gunicode.h>
#include <gal/util/e-iconv.h>
+#include "e-time-utils.h"
#include "camel-mime-utils.h"
#include "camel-charset-map.h"
@@ -3472,14 +3473,7 @@ header_decode_date(const char *in, int *saveoffset)
d(printf("named offset = %d\n", offset));
}
- t = mktime(&tm);
-#if defined(HAVE_TIMEZONE)
- t -= timezone;
-#elif defined(HAVE_TM_GMTOFF)
- t += tm.tm_gmtoff;
-#else
-#error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc.
-#endif
+ t = e_mktime_utc(&tm);
/* t is now GMT of the time we want, but not offset by the timezone ... */