Additional test for args in gadget text
[tangerine.git] / rom / timer / getsystime.c
blob87f256031f14115cbdd37aea7e6a4365b38cdccb
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: GetSysTime() - Find out what time it is.
6 Lang: english
7 */
8 #include "timer_intern.h"
9 #include <proto/exec.h>
11 /*****************************************************************************
13 NAME */
14 #include <devices/timer.h>
15 #include <proto/timer.h>
17 AROS_LH1(void, GetSysTime,
19 /* SYNOPSIS */
20 AROS_LHA(struct timeval *, dest, A0),
22 /* LOCATION */
23 struct Device *, TimerBase, 11, Timer)
25 /* FUNCTION
26 GetSysTime() will fill in the supplied timeval with the current
27 system time.
29 INPUTS
30 dest - A pointer to the timeval you want the time stored in.
32 RESULT
33 The timeval "dest" will be filled with the current system time.
35 NOTES
36 This function is safe to call from interrupts.
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 TR_GETSYSTIME, TR_SETSYSTIME
45 INTERNALS
47 HISTORY
48 18-02-1997 iaint Implemented.
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
53 AROS_LIBBASE_EXT_DECL(struct Library *,TimerBase)
55 struct TimerBase *timerBase = (struct TimerBase *)TimerBase;
57 Disable();
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;
70 #endif
71 Enable();
73 AROS_LIBFUNC_EXIT
74 } /* GetSysTime */