source: rtems/cpukit/score/src/coretodget.c @ 8d7aea0d

4.11
Last change on this file since 8d7aea0d was 8d7aea0d, checked in by Sebastian Huber <sebastian.huber@…>, on Sep 29, 2011 at 9:55:54 AM

2011-09-29 Sebastian Huber <sebastian.huber@…>

  • score/include/rtems/score/tod.h: Declare _TOD_Set_with_timestamp() and _TOD_Get_as_timestamp().
  • score/src/coretodset.c: Define _TOD_Set_with_timestamp().
  • score/src/coretodget.c: Define _TOD_Get_as_timestamp().
  • rtems/src/clockset.c: Use _TOD_Set_with_timestamp().
  • score/include/rtems/score/timestamp64.h, score/src/ts64set.c: Changed parameter types of _Timestamp64_Set().
  • rtems/src/clocktodtoseconds.c: Year 2100 is not a leap year.
  • Property mode set to 100644
File size: 1.0 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/timestamp.h>
22#include <rtems/score/tod.h>
23#include <rtems/score/watchdog.h>
24
25void _TOD_Get_as_timestamp(
26  Timestamp_Control *tod
27)
28{
29  ISR_Level         level;
30  Timestamp_Control offset;
31  Timestamp_Control now;
32  long              nanoseconds;
33
34  /* assume time checked for NULL by caller */
35
36  /* _TOD_Now is the native current time */
37  _ISR_Disable( level );
38    now = _TOD_Now;
39    nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)();
40  _ISR_Enable( level );
41
42  _Timestamp_Set( &offset, 0, nanoseconds );
43  _Timestamp_Add_to( &now, &offset );
44
45  *tod = now;
46}
Note: See TracBrowser for help on using the repository browser.