source: rtems/cpukit/score/src/coretodget.c @ 812da54

4.104.114.84.9
Last change on this file since 812da54 was 812da54, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 2, 2007 at 6:23:59 PM

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

  • itron/src/itrontime.c, libcsupport/src/gettod.c, posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h, posix/src/clockgettime.c, posix/src/clocksettime.c, posix/src/nanosleep.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c, posix/src/ptimer1.c, posix/src/sleep.c, rtems/Makefile.am, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/timer.h, rtems/include/rtems/rtems/types.h, rtems/src/clockget.c, rtems/src/clockset.c, rtems/src/clocktodtoseconds.c, rtems/src/clocktodvalidate.c, rtems/src/taskwakewhen.c, score/Makefile.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl, score/src/coretod.c, score/src/coretodset.c: Convert from Classic API style TOD_Control as fundamental time structure to POSIX struct timespec. Add clock_get_uptime().
  • rtems/src/clockgetuptime.c, score/src/coretodget.c, score/src/coretodgetuptime.c: New files.
  • score/src/coretodtickle.c, score/src/coretodtoseconds.c, score/src/coretodvalidate.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/tod.h>
21
22/*
23 *  _TOD_Get
24 *
25 *  This routine is used to obtain the current date and time.
26 *
27 *  Input parameters:
28 *    time  - pointer to the time and date structure
29 *
30 *  Output parameters: NONE
31 */
32
33void _TOD_Get(
34  struct timespec *time
35)
36{
37  ISR_Level level;
38  struct timespec offset;
39
40  /* assume time checked by caller */
41
42  offset.tv_sec = 0;
43  offset.tv_nsec = 0;
44
45  /* _TOD_Now is a proper POSIX time */
46  _ISR_Disable( level );
47    *time = _TOD_Now;
48    if ( _Watchdog_Nanoseconds_since_tick_handler )
49      offset.tv_nsec = (*_Watchdog_Nanoseconds_since_tick_handler)();
50  _ISR_Enable( level );
51
52  _TOD_Add_timespec( time, &offset );
53}
Note: See TracBrowser for help on using the repository browser.