use the override options if specified
[AROS.git] / rom / timer / getuptime.c
blob0be2c35c1b7e77eef46a4ef66c68898daac3ba92
1 /*
2 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: GetUpTime() - Get time since machine was powered on.
6 Lang: english
7 */
9 #include <proto/exec.h>
11 #include "timer_intern.h"
13 /*****************************************************************************
15 NAME */
16 #include <devices/timer.h>
17 #include <proto/timer.h>
19 AROS_LH1(void, GetUpTime,
21 /* SYNOPSIS */
22 AROS_LHA(struct timeval *, dest, A0),
24 /* LOCATION */
25 struct Device *, TimerBase, 12, Timer)
27 /* FUNCTION
28 GetUpTime() will fill in the supplied timeval with the current
29 uptime.
31 INPUTS
32 dest - A pointer to the timeval you want the time stored in.
34 RESULT
35 The timeval "dest" will be filled with the current uptime. This timer
36 cannot be changed by the software and thus can be considered to be a
37 monotonic clock..
39 NOTES
40 This function is safe to call from interrupts.
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 TR_GETSYSTIME, TR_SETSYSTIME, GetSysTime
49 INTERNALS
51 HISTORY
52 05-08-2018 schulz Implemented.
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 Disable();
60 /* Query the hardware */
61 EClockUpdate(GetTimerBase(TimerBase));
62 dest->tv_secs = GetTimerBase(TimerBase)->tb_Elapsed.tv_secs;
63 dest->tv_micro = GetTimerBase(TimerBase)->tb_Elapsed.tv_micro;
65 Enable();
67 AROS_LIBFUNC_EXIT
68 } /* GetUpTime */