Changeset 760

Show
Ignore:
Timestamp:
07/25/08 10:50:17 (4 months ago)
Author:
kaz
Message:
  • Rewrite date formatter with POSIX API
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/TwitterFon/Classes/Twitter/TimelineDownloader.m

    r759 r760  
    7878    // 
    7979    if (since) { 
    80         NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] 
    81                                            initWithDateFormat:@"%a %b %d %H:%M:%S %z %Y" 
    82                                            allowNaturalLanguage:NO] autorelease]; 
    83         NSDate *date = [dateFormatter dateFromString:since]; 
    84          
    85         NSTimeZone *tz = [NSTimeZone timeZoneWithAbbreviation:@"GMT"]; 
    86         NSString* since_param = [date descriptionWithCalendarFormat:@"%a, %d %b %Y %H:%M:%S GMT"  
    87                                                            timeZone:tz  
    88                                                              locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]; 
    89         url = [NSString stringWithFormat:@"%@?since=%@", url, since_param]; 
     80        struct tm time; 
     81        char timestr[128]; 
     82        setenv("TZ", "GMT", 1); 
     83        strptime([since UTF8String], "%a %b %d %H:%M:%S %z %Y", &time); 
     84        strftime(timestr, 128, "%a, %d %b %Y %H:%M:%S GMT", &time); 
     85        url = [NSString stringWithFormat:@"%@?since=%s", url, timestr]; 
    9086    } 
    9187