Re: strptime cannot parse date older than 1938
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Apr 24, 2008, at 12:43 AM, Surf Chen wrote: It is 70 ,not 69. Almost(few such as 1,Jan,2038 is parsed correctly) date strings later than 2038 is parsed as 70. steve$ cat date.c #include <stdio.h> #include <string.h> #include <time.h> int main() { char *date_str="Thu, 24-Apr-38 04:28:16 GMT"; struct tm tm; memset(&tm,0,sizeof(tm)); strptime(date_str,"%a, %d-%b-%y %H:%M:%S %Z",&tm); printf("%d\n",tm.tm_year); return 0; } steve$ gcc -Wall date.c steve$ ./a.out 69 -- Steve Checkoway "Anyone who says that the solution is to educate the users hasn't ever met an actual user." -- Bruce Schneier _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com I didn't play with any other dates, but I have no idea how you're getting 70 from the program you pasted. 69 is incorrect, but at least makes sense. smime.p7s
participants (1)
-
Steve Checkoway