OAR

RTEMS 4.5.1-pre3 On-Line Library


Clock Manager Time and Date Data Structures

PREV UP NEXT Bookshelf RTEMS C 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 structure for the native time and date format:

struct rtems_tod_control {
  rtems_unsigned32 year;   /* greater than 1987 */
  rtems_unsigned32 month;  /* 1 - 12 */
  rtems_unsigned32 day;    /* 1 - 31 */
  rtems_unsigned32 hour;   /* 0 - 23 */
  rtems_unsigned32 minute; /* 0 - 59 */
  rtems_unsigned32 second; /* 0 - 59 */
  rtems_unsigned32 ticks;  /* elapsed between seconds */
};

typedef struct rtems_tod_control rtems_time_of_day;

The native date and time format is the only format supported when setting the system date and time using the rtems_clock_get directive. Some applications expect to operate on a "UNIX-style" date and time data structure. The rtems_clock_get directive can optionally return the current date and time in the following structure:

typedef struct {
  rtems_unsigned32 seconds;       /* seconds since RTEMS epoch*/
  rtems_unsigned32 microseconds;  /* since last second        */
} rtems_clock_time_value;

The seconds field in this structure is the number of seconds since the RTEMS epoch of January 1, 1988.


PREV UP NEXT Bookshelf RTEMS C User's Guide

Copyright © 1988-2000 OAR Corporation