2 Copyright © 1995-2001, 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 *****************************************************************************/
53 AROS_LIBBASE_EXT_DECL(struct Library
*,TimerBase
)
55 struct TimerBase
*timerBase
= (struct TimerBase
*)TimerBase
;
58 dest
->tv_secs
= timerBase
->tb_CurrentTime
.tv_secs
;
59 dest
->tv_micro
= timerBase
->tb_CurrentTime
.tv_micro
;
60 #if 0 /* Messes up (accelerates) time if called very often
61 in short period of time (Doom). */
63 timerBase
->tb_CurrentTime
.tv_micro
+= 1;
64 if(timerBase
->tb_CurrentTime
.tv_micro
> 999999)
66 timerBase
->tb_CurrentTime
.tv_secs
+= 1;
67 /* MUST be zero since we are only adding 1 */
68 timerBase
->tb_CurrentTime
.tv_micro
= 0;