From a155e44fc1864c53865f9fa2314f62cdc3c1e612 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Wed, 2 Dec 1998 02:35:27 +0000 Subject: [PATCH] The mktime routine in MetroWerks MSL C Runtime Library on the Mac uses midnight 1 Jan 1900 as the epoch. So we need to adjust its return value to the NSPR epoch. Thanks to Brendan Eich and Chris Yeh for this fix. git-svn-id: svn://10.0.0.236/trunk@15607 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/nsprpub/pr/src/misc/prtime.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mozilla/nsprpub/pr/src/misc/prtime.c b/mozilla/nsprpub/pr/src/misc/prtime.c index 5054d406afb..4bf43fc8e7c 100644 --- a/mozilla/nsprpub/pr/src/misc/prtime.c +++ b/mozilla/nsprpub/pr/src/misc/prtime.c @@ -1567,6 +1567,15 @@ PR_ParseTimeString( secs = mktime(&localTime); if (secs != (time_t) -1) { +#if defined(XP_MAC) + /* + * The mktime() routine in MetroWerks MSL C + * Runtime library returns seconds since midnight, + * 1 Jan. 1900, not 1970. So we need to adjust + * its return value to the NSPR epoch. + */ + secs -= ((365 * 70UL) + 17) * 24 * 60 * 60; +#endif LL_I2L(*result, secs); LL_I2L(usec_per_sec, PR_USEC_PER_SEC); LL_MUL(*result, *result, usec_per_sec);