public
Description: A Clutter-based Twitter client
Homepage: http://live.gnome.org/Tweet
Clone URL: git://github.com/ebassi/tweet.git
Search Repo:
Fix the wrong status time conversion

Twitter already converts the time of the statuses into the timezone
of the user, as specified by her settings.

Unfortunately, they are still insane and use ctime().

Twitter also ignores the existence of DST, so London (for instance)
will only be on GMT+0.
Emmanuele Bassi (author)
Tue Jun 03 15:50:20 -0700 2008
commit  427e8e04565650594cf06fc6069f17642e3044a1
tree    eee91ded0b99540995bfad663cd17d6c4d7df814
parent  70fce3a9d80e2ef761372b9a9a8735bf711337ab
...
147
148
149
150
 
 
 
 
151
152
153
154
155
 
 
 
 
 
 
 
 
 
 
 
 
156
157
158
...
147
148
149
 
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
0
@@ -147,12 +147,27 @@ twitter_date_to_time_val (const gchar *date,
0
   {
0
     struct tm tmp;
0
 
0
- /* OMFG, what are they? insane? */
0
+ /* OMFG, ctime()? really? what are they? insane? and it's already been
0
+ * adjusted to the user settings instead of giving us the time of the
0
+ * status when it was sent
0
+ */
0
     strptime (date, "%a %b %d %T %z %Y", &tmp);
0
 
0
     res = mktime (&tmp);
0
     if (res != 0)
0
       {
0
+ time_t now_t;
0
+ struct tm now_tm;
0
+
0
+ time (&now_t);
0
+ localtime_r (&now_t, &now_tm);
0
+
0
+ /* twitter blissfully ignores the existence of the
0
+ * daylight saving time
0
+ */
0
+ if (now_tm.tm_isdst)
0
+ res += 3600;
0
+
0
         time_->tv_sec = res;
0
         time_->tv_usec = 0;
0
 

Comments

    No one has commented yet.