Re: strptime cannot parse date older than 1938
Re: strptime cannot parse date older than 1938
- Subject: Re: strptime cannot parse date older than 1938
- From: Steve Checkoway <email@hidden>
- Date: Thu, 24 Apr 2008 03:05:51 -0700
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
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.
--
Steve Checkoway
"Anyone who says that the solution is to educate the users
hasn't ever met an actual user." -- Bruce Schneier
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden