RTEMS Logo

RTEMS 4.9.2 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 {
  uint32_t year;   /* greater than 1987 */
  uint32_t month;  /* 1 - 12 */
  uint32_t day;    /* 1 - 31 */
  uint32_t hour;   /* 0 - 23 */
  uint32_t minute; /* 0 - 59 */
  uint32_t second; /* 0 - 59 */
  uint32_t 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 {
  uint32_t seconds;       /* seconds since RTEMS epoch*/
  uint32_t microseconds;  /* since last second        */
} rtems_clock_time_value;

The seconds field in this 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 C User's Guide

Copyright © 1988-2008 OAR Corporation