changeset 5279:36523a0d8459

[gaim-migrate @ 5651] iso8601 tweaks for jabber committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 01 May 2003 19:40:16 +0000
parents 1dcdc2504849
children c9116905a08c
files src/protocols/jabber/jabber.c
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Thu May 01 19:34:30 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Thu May 01 19:40:16 2003 +0000
@@ -1234,9 +1234,10 @@
 	struct tm t;
 	time_t retval = 0;
 	localtime_r(NULL, &t);
-
-	if(sscanf(timestamp, "%04d%02d%02dT%02d:%02d:%02d",
-		&t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec))
+	char tz[6] = "";
+
+	if(sscanf(timestamp, "%04d%02d%02dT%02d:%02d:%02d%5s",
+		&t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec, tz))
 	{
 		t.tm_year -= 1900;
 		t.tm_mon -= 1;
@@ -1249,6 +1250,16 @@
 				retval -= timezone;
 #		        endif
 #		endif
+
+		if(tz[0] == '+' || tz[0] == '-') {
+			int hr, min;
+			if(sscanf(tz+1, "%2d%2d", &hr, &min)) {
+				if(tz[0] == '+')
+					retval -= (hr*60 + min)*60;
+				else
+					retval += (hr*60 + min)*60;
+			}
+		}
 	}
 
 	return retval;