[gmime] Fixed military timezone offsets



commit e736301ac61931edfa2d9e4446d37908628ab160
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Sat Oct 10 20:22:33 2009 -0400

    Fixed military timezone offsets
    
    2009-10-10  Jeffrey Stedfast  <fejj novell com>
    
    	* gmime/gmime-utils.c: Fixed the military timezone offsets.

 ChangeLog           |    2 +
 gmime/gmime-utils.c |   57 +++++++++++++++++++++++++++++++++++---------------
 2 files changed, 42 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c34bf4f..fcde714 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2009-10-10  Jeffrey Stedfast  <fejj novell com>
 
+	* gmime/gmime-utils.c: Fixed the military timezone offsets.
+
 	* gmime/gmime-encodings.c (g_mime_encoding_uudecode_step): Fixed a
 	uudecoding bug when uulen % 3 is 2. Thanks to Peter Hartley. Fixes
 	bug #597794.
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index 0df8583..0eb03cc 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -122,26 +122,49 @@ static unsigned char gmime_datetok_table[256] = {
 	111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
 };
 
-/* hrm, is there a library for this shit? */
+/* Timezone values defined in rfc5322 */
 static struct {
-	char *name;
+	const char *name;
 	int offset;
 } tz_offsets [] = {
-	{ "UT", 0 },
-	{ "GMT", 0 },
-	{ "EST", -500 },	/* these are all US timezones.  bloody yanks */
-	{ "EDT", -400 },
-	{ "CST", -600 },
-	{ "CDT", -500 },
-	{ "MST", -700 },
-	{ "MDT", -600 },
-	{ "PST", -800 },
-	{ "PDT", -700 },
-	{ "Z", 0 },
-	{ "A", -100 },
-	{ "M", -1200 },
-	{ "N", 100 },
-	{ "Y", 1200 },
+	{ "UT",       0 },
+	{ "GMT",      0 },
+	{ "EDT",   -400 },
+	{ "EST",   -500 },
+	{ "CDT",   -500 },
+	{ "CST",   -600 },
+	{ "MDT",   -600 },
+	{ "MST",   -700 },
+	{ "PDT",   -700 },
+	{ "PST",   -800 },
+	/* Note: rfc822 got the signs backwards for the military
+	 * timezones so some sending clients may mistakenly use the
+	 * wrong values. */
+	{ "A",      100 },
+	{ "B",      200 },
+	{ "C",      300 },
+	{ "D",      400 },
+	{ "E",      500 },
+	{ "F",      600 },
+	{ "G",      700 },
+	{ "H",      800 },
+	{ "I",      900 },
+	{ "K",     1000 },
+	{ "L",     1100 },
+	{ "M",     1200 },
+	{ "N",     -100 },
+	{ "O",     -200 },
+	{ "P",     -300 },
+	{ "Q",     -400 },
+	{ "R",     -500 },
+	{ "S",     -600 },
+	{ "T",     -700 },
+	{ "U",     -800 },
+	{ "V",     -900 },
+	{ "W",    -1000 },
+	{ "X",    -1100 },
+	{ "Y",    -1200 },
+	{ "Z",        0 },
 };
 
 static char *tm_months[] = {



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