cpw.darkrain42.xmpp.iq-handlers: b6361e0d: Report the correct UTC time (thanks for ...

paul at darkrain42.org paul at darkrain42.org
Sun Feb 8 17:00:34 EST 2009


-----------------------------------------------------------------
Revision: b6361e0db7bc7aec464064fa55eb3f14e58bc322
Ancestor: d5d8432928806878610ffc4292e088148b7f0dbb
Author: paul at darkrain42.org
Date: 2009-02-08T21:56:03
Branch: im.pidgin.cpw.darkrain42.xmpp.iq-handlers
URL: http://d.pidgin.im/viewmtn/revision/info/b6361e0db7bc7aec464064fa55eb3f14e58bc322

Modified files:
        libpurple/protocols/jabber/iq.c

ChangeLog: 

Report the correct UTC time (thanks for noticing this, Marcus).

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/iq.c	fcb878c59dbc14fc59f064e84fa3aefb18befbfb
+++ libpurple/protocols/jabber/iq.c	246373851ec892116e7e4513348ef743a0dfad2d
@@ -173,10 +173,15 @@ static void jabber_iq_time_parse(JabberS
 	const char *xmlns;
 	JabberIq *iq;
 	time_t now_t;
+	struct tm now_local;
+	struct tm now_utc;
 	struct tm *now;
 
 	time(&now_t);
 	now = localtime(&now_t);
+	memcpy(&now_local, now, sizeof(struct tm));
+	now = gmtime(&now_t);
+	memcpy(&now_utc, now, sizeof(struct tm));
 
 	xmlns = xmlnode_get_namespace(child);
 
@@ -194,19 +199,19 @@ static void jabber_iq_time_parse(JabberS
 		utc = xmlnode_new_child(child, "utc");
 
 		if(!strcmp("urn:xmpp:time", xmlns)) {
-			tz = purple_get_tzoff_str(now, TRUE);
+			tz = purple_get_tzoff_str(&now_local, TRUE);
 			xmlnode_insert_data(xmlnode_new_child(child, "tzo"), tz, -1);
 
-			date = purple_utf8_strftime("%FT%TZ", now);
+			date = purple_utf8_strftime("%FT%TZ", &now_utc);
 			xmlnode_insert_data(utc, date, -1);
 		} else { /* jabber:iq:time */
-			tz = purple_utf8_strftime("%Z", now);
+			tz = purple_utf8_strftime("%Z", &now_local);
 			xmlnode_insert_data(xmlnode_new_child(child, "tz"), tz, -1);
 
-			date = purple_utf8_strftime("%Y%m%dT%T", now);
+			date = purple_utf8_strftime("%Y%m%dT%T", &now_utc);
 			xmlnode_insert_data(utc, date, -1);
 
-			display = purple_utf8_strftime("%d %b %Y %T", now);
+			display = purple_utf8_strftime("%d %b %Y %T", &now_local);
 			xmlnode_insert_data(xmlnode_new_child(child, "display"), display, -1);
 		}
 


More information about the Commits mailing list