diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-24 18:02:07 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-24 18:02:07 +0100 |
commit | ae3dc9996f5a678d6364005cab1517b6324eb67a (patch) | |
tree | d62ac84957cafa2f956ab82e0ff20505c64f2250 /protocols/jabber/jabber_util.c | |
parent | b5b40ffd38e315223c6e38e4a291cbd58e471062 (diff) | |
parent | f1b7711f566163ff27a8f13ae3ccc7214a24fe70 (diff) |
Merging stuff from mainline (1.2.6).
Diffstat (limited to 'protocols/jabber/jabber_util.c')
-rw-r--r-- | protocols/jabber/jabber_util.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index bd2fbe8c..4bc9e3a8 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -670,10 +670,9 @@ int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid ) time_t jabber_get_timestamp( struct xt_node *xt ) { - struct tm tp, utc; struct xt_node *c; - time_t res, tres; char *s = NULL; + struct tm tp; for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) { @@ -691,30 +690,8 @@ time_t jabber_get_timestamp( struct xt_node *xt ) tp.tm_year -= 1900; tp.tm_mon --; - tp.tm_isdst = -1; /* GRRRRRRRRRRR */ - - res = mktime( &tp ); - /* Problem is, mktime() just gave us the GMT timestamp for the - given local time... While the given time WAS NOT local. So - we should fix this now. - - Now I could choose between messing with environment variables - (kludgy) or using timegm() (not portable)... Or doing the - following, which I actually prefer... */ - gmtime_r( &res, &utc ); - utc.tm_isdst = -1; /* Once more: GRRRRRRRRRRRRRRRRRR!!! */ - if( utc.tm_hour == tp.tm_hour && utc.tm_min == tp.tm_min ) - /* Sweet! We're in UTC right now... */ - return res; - - tres = mktime( &utc ); - res += res - tres; - - /* Yes, this is a hack. And it will go wrong around DST changes. - BUT this is more likely to be threadsafe than messing with - environment variables, and possibly more portable... */ - - return res; + + return mktime_utc( &tp ); } struct jabber_error *jabber_error_parse( struct xt_node *node, char *xmlns ) |