strptime_l
は常に null を返します。私はObjective-Cでこれをやっています。
#import <time.h>
#import <xlocale.h>
/* Later on... */
const char *str = [dateStr UTF8String];
const char *fmt = [@"EE LLLL d HH:mm:ss Z yyyy" UTF8String];
struct tm timeinfo;
memset(&timeinfo, 0, sizeof(timeinfo));
char *ret = strptime_l(str, fmt, &timeinfo, NULL);
NSDate *date = nil;
if (ret) {
time_t time = mktime(&timeinfo);
date = [NSDate dateWithTimeIntervalSince1970:time];
}
ret
は常に null です。dateStr
の値の例は次のとおりSat Sep 15 05:52:10 +0000 2012
です。常にその形式です。
何か案は?