Changeset c16bcc0 in rtems for cpukit/score/src/coretodget.c


Ignore:
Timestamp:
Dec 8, 2008, 7:41:31 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
601b863
Parents:
6d10c29
Message:

2008-12-08 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/times.c, libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuusagereset.c, posix/src/clockgettime.c, posix/src/pthread.c, posix/src/timersettime.c, rtems/include/rtems/rtems/ratemon.h, rtems/src/clockgetsecondssinceepoch.c, rtems/src/clockgetuptime.c, rtems/src/ratemongetstatus.c, rtems/src/ratemonperiod.c, rtems/src/ratemonreportstatistics.c, rtems/src/taskwakewhen.c, rtems/src/timerfirewhen.c, rtems/src/timerserver.c, rtems/src/timerserverfirewhen.c, score/Makefile.am, score/preinstall.am, score/include/rtems/score/thread.h, score/include/rtems/score/tod.h, score/src/coretod.c, score/src/coretodget.c, score/src/coretodgetuptime.c, score/src/coretodset.c, score/src/coretodtickle.c, score/src/threaddispatch.c, score/src/threadinitialize.c: Add SuperCore? handler Timestamp to provide an opaque class for the representation and manipulation of uptime, time of day, and the difference between two timestamps. By using SuperCore? Timestamp, it is clear which methods and APIs really have to be struct timespec and which can be in an optimized native format.
  • score/include/rtems/score/timestamp.h, score/src/coretodgetuptimetimespec.c: New files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/coretodget.c

    r6d10c29 rc16bcc0  
    1919#include <rtems/score/isr.h>
    2020#include <rtems/score/timespec.h>
     21#include <rtems/score/timestamp.h>
    2122#include <rtems/score/tod.h>
    2223#include <rtems/score/watchdog.h>
     
    3738)
    3839{
    39   ISR_Level level;
    40   struct timespec offset;
     40  ISR_Level         level;
     41  Timestamp_Control offset;
     42  Timestamp_Control now;
     43  long              nanoseconds;
    4144
    42   /* assume time checked by caller */
     45  /* assume time checked for NULL by caller */
    4346
    44   offset.tv_sec = 0;
    45   offset.tv_nsec = 0;
    46 
    47   /* _TOD_Now is a proper POSIX time */
     47  /* _TOD_Now is the native current time */
     48  nanoseconds = 0;
    4849  _ISR_Disable( level );
    49     *time = _TOD_Now;
     50    now = _TOD_Now;
    5051    if ( _Watchdog_Nanoseconds_since_tick_handler )
    51       offset.tv_nsec = (*_Watchdog_Nanoseconds_since_tick_handler)();
     52      nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)();
    5253  _ISR_Enable( level );
    5354
    54   _Timespec_Add_to( time, &offset );
     55  _Timestamp_Set( &offset, 0, nanoseconds );
     56  _Timestamp_Add_to( &now, &offset );
     57  _Timestamp_To_timespec( &now, time );
    5558}
Note: See TracChangeset for help on using the changeset viewer.