4.115
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Obtain the System Uptime |
---|
5 | * @ingroup ClassicClock Clocks |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/system.h> |
---|
22 | #include <rtems/rtems/status.h> |
---|
23 | #include <rtems/rtems/clock.h> |
---|
24 | #include <rtems/score/isr.h> |
---|
25 | #include <rtems/score/thread.h> |
---|
26 | #include <rtems/score/timestamp.h> |
---|
27 | #include <rtems/score/tod.h> |
---|
28 | #include <rtems/score/watchdog.h> |
---|
29 | |
---|
30 | /* |
---|
31 | * rtems_clock_get_uptime |
---|
32 | * |
---|
33 | * This directive obtains the system uptime. A timestamp is the seconds |
---|
34 | * and nanoseconds since boot. |
---|
35 | * |
---|
36 | * Input parameters: |
---|
37 | * timestamp - pointer to the timestamp |
---|
38 | * |
---|
39 | * Output parameters: |
---|
40 | * *uptime - filled in |
---|
41 | * RTEMS_SUCCESSFUL - if successful |
---|
42 | * error code - if unsuccessful |
---|
43 | */ |
---|
44 | rtems_status_code rtems_clock_get_uptime( |
---|
45 | struct timespec *uptime |
---|
46 | ) |
---|
47 | { |
---|
48 | if ( !uptime ) |
---|
49 | return RTEMS_INVALID_ADDRESS; |
---|
50 | |
---|
51 | _TOD_Get_uptime_as_timespec( uptime ); |
---|
52 | return RTEMS_SUCCESSFUL; |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.