RTEMS Logo

RTEMS 4.10.2 On-Line Library


Clock Manager Time and Date Data Structures

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

7.2.2: Time and Date Data Structures

The clock facilities of the clock manager operate upon calendar time. These directives utilize the following date and time record for the native time and date format:

type Time_Of_Day is
   record
      Year    : RTEMS.Unsigned32; -- year, A.D.
      Month   : RTEMS.Unsigned32; -- month, 1 .. 12
      Day     : RTEMS.Unsigned32; -- day, 1 .. 31
      Hour    : RTEMS.Unsigned32; -- hour, 0 .. 23
      Minute  : RTEMS.Unsigned32; -- minute, 0 .. 59
      Second  : RTEMS.Unsigned32; -- second, 0 .. 59
      Ticks   : RTEMS.Unsigned32; -- elapsed ticks between seconds
   end record;

The native date and time format is the only format supported when setting the system date and time using the rtems.clock_set directive. Some applications expect to operate on a "UNIX-style" date and time data structure. The rtems.clock_get_tod_timeval always returns the date and time in struct timeval format. The rtems.clock_get directive can optionally return the current date and time in this format.

The struct timeval data structure has two fields: tv_sec and tv_usec which are seconds and microseconds, respectively. The tv_sec field in this data structure is the number of seconds since the POSIX epoch of January 1, 1970 but will never be prior to the RTEMS epoch of January 1, 1988.


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2008 OAR Corporation