diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-11 21:41:23 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-11 21:41:23 +0100 |
commit | 2b02617289671ececbd98a209cb44aca81c22a65 (patch) | |
tree | c4bbaf9000215cc7845b6a2525805f09f7c9a6f8 | |
parent | 72176c140636532347141dc011959d676df50d2f (diff) |
strptime() on FreeBSD (and possibly other non-glibc platforms) %z is not
supported, so just insert the literal timezone there - let's hope Twitter
won't ever change that.
-rw-r--r-- | protocols/twitter/twitter_lib.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index f9e808f7..22d2a3bd 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -356,6 +356,11 @@ static xt_status twitter_xt_get_user_list( struct xt_node *node, struct twitter_ return XT_HANDLED; } +#ifdef __GLIBC__ +#define TWITTER_TIME_FORMAT "%a %b %d %H:%M:%S %z %Y" +#else +#define TWITTER_TIME_FORMAT "%a %b %d %H:%M:%S +0000 %Y" +#endif /** * Function to fill a twitter_xml_status struct. @@ -392,7 +397,7 @@ static xt_status twitter_xt_get_status( struct xt_node *node, struct twitter_xml /* Very sensitive to changes to the formatting of this field. :-( Also assumes the timezone used is UTC since C time handling functions suck. */ - if( strptime( child->text, "%a %b %d %H:%M:%S %z %Y", &parsed ) != NULL ) + if( strptime( child->text, TWITTER_TIME_FORMAT, &parsed ) != NULL ) txs->created_at = mktime_utc( &parsed ); } else if (g_strcasecmp( "user", child->name ) == 0) |