4.115
Last change
on this file since c499856 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
Property mode set to
100644
|
File size:
887 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Returns the system uptime in seconds. |
---|
5 | * @ingroup ClassicClock Clocks |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * Copyright (c) 2013 Chris Johns <chrisj@rtems.org>. All rights reserved. |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.org/license/LICENSE. |
---|
14 | */ |
---|
15 | |
---|
16 | #if HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <rtems/rtems/clock.h> |
---|
21 | #include <rtems/score/todimpl.h> |
---|
22 | |
---|
23 | uint64_t rtems_clock_get_uptime_nanoseconds( void ) |
---|
24 | { |
---|
25 | Timestamp_Control snapshot_as_timestamp; |
---|
26 | uint32_t nanoseconds; |
---|
27 | ISR_lock_Context lock_context; |
---|
28 | |
---|
29 | _TOD_Acquire( &_TOD, &lock_context ); |
---|
30 | snapshot_as_timestamp = _TOD.uptime; |
---|
31 | nanoseconds = ( *_TOD.nanoseconds_since_last_tick )(); |
---|
32 | _TOD_Release( &_TOD, &lock_context ); |
---|
33 | |
---|
34 | return _Timestamp_Get_As_nanoseconds( &snapshot_as_timestamp, nanoseconds ); |
---|
35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.