source: rtems/cpukit/score/src/coretodgetuptime.c @ 6a614160

4.104.115
Last change on this file since 6a614160 was 6a614160, checked in by Joel Sherrill <joel.sherrill@…>, on 12/05/08 at 22:27:47

2008-12-05 Joel Sherrill <joel.sherrill@…>

  • score/include/rtems/score/timespec.h: Remove unnecessary includes. Fix typo.
  • posix/include/rtems/posix/time.h, score/src/coretodget.c, score/src/coretodgetuptime.c: Add required include files which were formerly included from timespec.h
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  Time of Day (TOD) Handler - get uptime
3 */
4
5/*  COPYRIGHT (c) 1989-2008.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/isr.h>
21#include <rtems/score/timespec.h>
22#include <rtems/score/tod.h>
23#include <rtems/score/watchdog.h>
24
25/*
26 *  _TOD_Get_uptime
27 *
28 *  This routine is used to obtain the system uptime
29 *
30 *  Input parameters:
31 *    time  - pointer to the time and date structure
32 *
33 *  Output parameters: NONE
34 */
35
36void _TOD_Get_uptime(
37  struct timespec *uptime
38)
39{
40  ISR_Level level;
41  struct timespec offset;
42
43  /* assume uptime checked by caller */
44
45  offset.tv_sec = 0;
46  offset.tv_nsec = 0;
47
48  _ISR_Disable( level );
49    *uptime = _TOD_Uptime;
50    if ( _Watchdog_Nanoseconds_since_tick_handler )
51      offset.tv_nsec = (*_Watchdog_Nanoseconds_since_tick_handler)();
52  _ISR_Enable( level );
53
54  _Timespec_Add_to( uptime, &offset );
55}
Note: See TracBrowser for help on using the repository browser.