[Amizilla-cvs] amizilla/nsprpub/pr/src/md/amiga atime.c,1.8,1.9
Brought to you by:
maxlarsson
From: Jeff S. <jsh...@us...> - 2004-10-14 22:50:26
|
Update of /cvsroot/amizilla/amizilla/nsprpub/pr/src/md/amiga In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31118 Modified Files: atime.c Log Message: Fixed PR_Now to return the correct time. Took out commented out debug lines. Index: atime.c =================================================================== RCS file: /cvsroot/amizilla/amizilla/nsprpub/pr/src/md/amiga/atime.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** atime.c 22 Jun 2004 00:12:59 -0000 1.8 --- atime.c 14 Oct 2004 22:50:15 -0000 1.9 *************** *** 37,40 **** --- 37,42 ---- #include <proto/timer.h> + #define DAYS_SINCE_1970 (8*365+2) + static _PR_MD_Timeout _PR_Sleep(PRIntervalTime timeout) { *************** *** 48,52 **** if (_PR_PENDING_INTERRUPT(thread)) { - printf("%lx sleep got a pending interrupt\n", thread); PR_ClearInterrupt(); PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0); --- 50,53 ---- *************** *** 62,66 **** timerIO->tr_time.tv_micro = timeout % _PR_MD_INTERVAL_PER_SEC() * (1000000 / _PR_MD_INTERVAL_PER_SEC()); - //printf("%lx, Beginning IO for sleep\n", thread); thread->io_pending = PR_TRUE; --- 63,66 ---- *************** *** 71,75 **** if (_PR_PENDING_INTERRUPT(thread)) { PR_ClearInterrupt(); - printf("%lx, Sleep got interrupted\n", thread); PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0); retval = INTERRUPTED; --- 71,74 ---- *************** *** 83,96 **** ; - // printf("%lx, got msg %lx\n", thread, msg); if (!(CheckIO((struct IORequest *)timerIO))) { - //printf("%lx abort io\n", thread); AbortIO((struct IORequest *)timerIO); - //printf("%lx wait IO\n", thread); WaitIO((struct IORequest *)timerIO); } thread->io_pending = PR_FALSE; done: - //printf("%lx done sleep returning\n", thread); return retval; } --- 82,91 ---- *************** *** 126,130 **** PRTime retval = LL_INIT(0,0); struct timerequest *tr = PR_NEWZAP(struct timerequest); ! PRInt64 secs, mil; if (!(OpenDevice(TIMERNAME, UNIT_MICROHZ, (struct IORequest *)tr, 0))) { --- 121,125 ---- PRTime retval = LL_INIT(0,0); struct timerequest *tr = PR_NEWZAP(struct timerequest); ! PRInt64 secs, mil, offset; if (!(OpenDevice(TIMERNAME, UNIT_MICROHZ, (struct IORequest *)tr, 0))) { *************** *** 132,136 **** struct Library *TimerBase = (struct Library *)tr->tr_node.io_Device; GetSysTime(&tv); ! /* retval = tv.tv_sec * 1000000 + tv.tv_usec */ LL_I2L(secs, tv.tv_sec); LL_I2L(mil, 1000000); --- 127,133 ---- struct Library *TimerBase = (struct Library *)tr->tr_node.io_Device; GetSysTime(&tv); ! /* retval = tv.tv_sec * 1000000 + tv.tv_usec + usecs since 1970 to 1978 ! * ( Amiga's time is based upon Jan 1, 1978) ! */ LL_I2L(secs, tv.tv_sec); LL_I2L(mil, 1000000); *************** *** 138,142 **** LL_I2L(mil, tv.tv_usec); LL_ADD(retval, secs, mil); ! CloseDevice((struct IORequest *)tr); } --- 135,142 ---- LL_I2L(mil, tv.tv_usec); LL_ADD(retval, secs, mil); ! LL_I2L(offset, DAYS_SINCE_1970); ! LL_MUL(offset, offset, 86400); ! LL_MUL(offset, offset, 1000000); ! LL_ADD(retval, retval, offset); CloseDevice((struct IORequest *)tr); } |