Re: strptime cannot parse date older than 1938
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Apr 25, 2008, at 6:54 AM, Martin Costabel wrote: Thanks to the useful replies here. struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ int tm_hour; /* hours since midnight [0-23] */ int tm_mday; /* day of the month [1-31] */ int tm_mon; /* months since January [0-11] */ int tm_year; /* years since 1900 */ int tm_wday; /* days since Sunday [0-6] */ int tm_yday; /* days since January 1 [0-365] */ int tm_isdst; /* Daylight Savings Time flag */ long tm_gmtoff; /* offset from CUT in seconds */ char *tm_zone; /* timezone abbreviation */ }; Remember back in 1999 when Apple was running ads talking about Y2K? I guess FAQ #1 here http://docs.info.apple.com/article.html?artnum=19843 isn't quite right anymore. -Jamie -- Jamison Hope The PTR Group www.theptrgroup.com _______________________________________________ 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... Terry Lambert wrote: On Apr 25, 2008, at 12:10 AM, Surf Chen wrote: But I need to ask a final question:On Mac OSX and with 32 bit compile option, How to parse "Thu, 24-Apr-38 04:28:16 GMT" to struct tm or other structs like that? Do I need to down or write an alternative lib to parse it? You don't, it's out of range. What is out of range in struct tm? The only thing that can be out of range is the number of seconds from the Epoch, but this is not a member of struct tm: That's why it's called "The UNIX Y2038 bug". That's right, this is a bug. A bug in Apple's implementation of the strptime function. There is no mention of 2038 in the documentation of this function, and there is no reason why it should not work as advertised, even on a 32bit system. It's a bug that should be fixed. "We may not get everything right, but at least we knew the century was going to end. Macintosh was designed to work perfectly with dates all the way up to the year 29,940. But have no fear. We’re already hard at work on the Y30K problem." This email sent to site_archiver@lists.apple.com
participants (1)
-
Jamison Hope