source: rtems/cpukit/score/src/coretodgetuptime.c @ bd029d87

4.8
Last change on this file since bd029d87 was 412dbff6, checked in by Joel Sherrill <joel.sherrill@…>, on 04/05/07 at 21:17:27

2007-04-05 Joel Sherrill <joel@…>

  • posix/Makefile.am, posix/include/rtems/posix/time.h, posix/src/adjtime.c, posix/src/alarm.c, posix/src/clockgetres.c, posix/src/condtimedwait.c, posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c, posix/src/mutextimedlock.c, posix/src/nanosleep.c, posix/src/posixtimespecabsolutetimeout.c, posix/src/pthread.c, posix/src/pthreadcreate.c, posix/src/pthreadsetschedparam.c, posix/src/ptimer1.c, posix/src/sched.c, posix/src/semtimedwait.c, posix/src/sigtimedwait.c, posix/src/ualarm.c, rtems/src/clocktodtoseconds.c, score/Makefile.am, score/preinstall.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl, score/src/coretod.c, score/src/coretodget.c, score/src/coretodgetuptime.c, score/src/coretodset.c, score/src/coretodtickle.c: Provide timespec manipulation routines in the SuperCore?. Use them everywhere possible. This lead to significant cleanup in the API routines and eliminated some of the same code from the POSIX API. At this point, the SuperCore? keeps time in POSIX timespec format properly from 1970. You just cannot set it before 1988 in keeping with RTEMS traditional behavior.
  • score/include/rtems/score/timespec.h, score/src/timespecaddto.c, score/src/timespecfromticks.c, score/src/timespecisvalid.c, score/src/timespeclessthan.c, score/src/timespecsubtract.c, score/src/timespectoticks.c: New files.
  • posix/src/posixintervaltotimespec.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c: Removed.
  • 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-2007.
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
24/*
25 *  _TOD_Get_uptime
26 *
27 *  This routine is used to obtain the system uptime
28 *
29 *  Input parameters:
30 *    time  - pointer to the time and date structure
31 *
32 *  Output parameters: NONE
33 */
34
35void _TOD_Get_uptime(
36  struct timespec *uptime
37)
38{
39  ISR_Level level;
40  struct timespec offset;
41
42  /* assume uptime checked by caller */
43
44  offset.tv_sec = 0;
45  offset.tv_nsec = 0;
46
47  _ISR_Disable( level );
48    *uptime = _TOD_Uptime;
49    if ( _Watchdog_Nanoseconds_since_tick_handler )
50      offset.tv_nsec = (*_Watchdog_Nanoseconds_since_tick_handler)();
51  _ISR_Enable( level );
52
53  _Timespec_Add_to( uptime, &offset );
54}
Note: See TracBrowser for help on using the repository browser.