2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: GetSysTime() - Find out what time it is.
8 #include "timer_intern.h"
9 #include <proto/exec.h>
11 /*****************************************************************************
14 #include <devices/timer.h>
15 #include <proto/timer.h>
17 AROS_LH1(void, GetSysTime
,
20 AROS_LHA(struct timeval
*, dest
, A0
),
23 struct Device
*, TimerBase
, 11, Timer
)
26 GetSysTime() will fill in the supplied timeval with the current
30 dest - A pointer to the timeval you want the time stored in.
33 The timeval "dest" will be filled with the current system time.
36 This function is safe to call from interrupts.
43 TR_GETSYSTIME, TR_SETSYSTIME
48 18-02-1997 iaint Implemented.
50 *****************************************************************************/
54 struct TimerBase
*timerBase
= (struct TimerBase
*)TimerBase
;
57 dest
->tv_secs
= timerBase
->tb_CurrentTime
.tv_secs
;
58 dest
->tv_micro
= timerBase
->tb_CurrentTime
.tv_micro
;
59 #if 0 /* Messes up (accelerates) time if called very often
60 in short period of time (Doom). */
62 timerBase
->tb_CurrentTime
.tv_micro
+= 1;
63 if(timerBase
->tb_CurrentTime
.tv_micro
> 999999)
65 timerBase
->tb_CurrentTime
.tv_secs
+= 1;
66 /* MUST be zero since we are only adding 1 */
67 timerBase
->tb_CurrentTime
.tv_micro
= 0;