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
This commit is contained in:
wtc%netscape.com
1998-12-02 02:35:27 +00:00
parent 1ca4c61fe1
commit a155e44fc1

View File

@@ -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);