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

4.104.11
Last change on this file since 6a614160 was 6a614160, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 5, 2008 at 10:27:47 PM

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 TOD
3 *
4 *  COPYRIGHT (c) 1989-2008.
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#include <rtems/score/watchdog.h>
23
24/*
25 *  _TOD_Get
26 *
27 *  This routine is used to obtain the current date and time.
28 *
29 *  Input parameters:
30 *    time  - pointer to the time and date structure
31 *
32 *  Output parameters: NONE
33 */
34
35void _TOD_Get(
36  struct timespec *time
37)
38{
39  ISR_Level level;
40  struct timespec offset;
41
42  /* assume time checked by caller */
43
44  offset.tv_sec = 0;
45  offset.tv_nsec = 0;
46
47  /* _TOD_Now is a proper POSIX time */
48  _ISR_Disable( level );
49    *time = _TOD_Now;
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( time, &offset );
55}
Note: See TracBrowser for help on using the repository browser.