source: rtems/cpukit/score/src/coretodget.c @ 412dbff6

4.104.114.84.9
Last change on this file since 412dbff6 was 412dbff6, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 5, 2007 at 9:17:27 PM

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 TOD
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/timespec.h>
21#include <rtems/score/tod.h>
22
23/*
24 *  _TOD_Get
25 *
26 *  This routine is used to obtain the current date and time.
27 *
28 *  Input parameters:
29 *    time  - pointer to the time and date structure
30 *
31 *  Output parameters: NONE
32 */
33
34void _TOD_Get(
35  struct timespec *time
36)
37{
38  ISR_Level level;
39  struct timespec offset;
40
41  /* assume time checked by caller */
42
43  offset.tv_sec = 0;
44  offset.tv_nsec = 0;
45
46  /* _TOD_Now is a proper POSIX time */
47  _ISR_Disable( level );
48    *time = _TOD_Now;
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( time, &offset );
54}
Note: See TracBrowser for help on using the repository browser.