RTEMS Logo

RTEMS 4.10.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_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 C User's Guide

Copyright © 1988-2008 OAR Corporation