RTEMS
Classes | Macros | Typedefs | Enumerations | Functions | Variables
todimpl.h File Reference

Time of Day Handler API. More...

#include <rtems/score/status.h>
#include <rtems/score/timestamp.h>
#include <rtems/score/timecounterimpl.h>
#include <rtems/score/watchdog.h>
#include <sys/time.h>
#include <time.h>

Go to the source code of this file.

Classes

struct  TOD_Control
 TOD control. More...
 
struct  TOD_Hook
 Structure to manage each TOD action hook. More...
 

Macros

#define TOD_SECONDS_PER_MINUTE   (uint32_t)60
 
#define TOD_MINUTES_PER_HOUR   (uint32_t)60
 
#define TOD_MONTHS_PER_YEAR   (uint32_t)12
 
#define TOD_DAYS_PER_YEAR   (uint32_t)365
 
#define TOD_HOURS_PER_DAY   (uint32_t)24
 
#define TOD_SECONDS_PER_DAY
 
#define TOD_SECONDS_PER_NON_LEAP_YEAR   (365 * TOD_SECONDS_PER_DAY)
 
#define TOD_MILLISECONDS_PER_SECOND   (uint32_t)1000
 
#define TOD_MICROSECONDS_PER_SECOND   (uint32_t)1000000
 
#define TOD_NANOSECONDS_PER_SECOND   (uint32_t)1000000000
 
#define TOD_NANOSECONDS_PER_MICROSECOND   (uint32_t)1000
 
#define TOD_SECONDS_1970_THROUGH_1988
 
#define TOD_BASE_YEAR   1988
 Earliest year to which an time of day can be initialized. More...
 
#define TOD_TICKS_PER_SECOND   TOD_TICKS_PER_SECOND_method()
 Gets number of ticks in a second. More...
 

Typedefs

typedef struct TOD_Hook TOD_Hook
 Structure to manage each TOD action hook.
 

Enumerations

enum  TOD_Action { TOD_ACTION_SET_CLOCK }
 Possible actions where a registered hook could be invoked. More...
 

Functions

void _TOD_Lock (void)
 Locks the time of day mutex.
 
void _TOD_Unlock (void)
 Unlocks the time of day mutex.
 
static void _TOD_Acquire (ISR_lock_Context *lock_context)
 Checks if api mutex is owner of the time of day mutex. More...
 
static void _TOD_Release (ISR_lock_Context *lock_context)
 Releases the lock context for the timecounter. More...
 
Status_Control _TOD_Set (const struct timespec *tod, ISR_lock_Context *lock_context)
 Sets the time of day. More...
 
static void _TOD_Get (struct timespec *tod)
 Gets the current time in the timespec format. More...
 
static void _TOD_Get_uptime (Timestamp_Control *time)
 Gets the system uptime with potential accuracy to the nanosecond. More...
 
static void _TOD_Get_zero_based_uptime (Timestamp_Control *time)
 Gets the system uptime with potential accuracy to the nanosecond. More...
 
static void _TOD_Get_zero_based_uptime_as_timespec (struct timespec *time)
 Gets the system uptime with potential accuracy to the nanosecond. More...
 
static uint32_t _TOD_Seconds_since_epoch (void)
 Returns Number of seconds Since RTEMS epoch. More...
 
uint32_t TOD_TICKS_PER_SECOND_method (void)
 Gets number of ticks in a second. More...
 
static __inline__ void _TOD_Get_timeval (struct timeval *time)
 This routine returns a timeval based upon the internal timespec format TOD. More...
 
void _TOD_Adjust (const struct timespec *delta)
 Adjusts the Time of Time. More...
 
static __inline__ bool _TOD_Is_set (void)
 Check if the TOD is Set. More...
 
void _TOD_Hook_Register (TOD_Hook *hook)
 Add a TOD Action Hook. More...
 
void _TOD_Hook_Unregister (TOD_Hook *hook)
 Remove a TOD Action Hook. More...
 
Status_Control _TOD_Hook_Run (TOD_Action action, const struct timespec *tod)
 Run the TOD Action Hooks. More...
 

Variables

TOD_Control _TOD
 TOD Management information.
 
Chain_Control _TOD_Hooks
 Set of registered methods for TOD Actions.
 

Detailed Description

Time of Day Handler API.

Definition in file todimpl.h.

Macro Definition Documentation

◆ TOD_BASE_YEAR

#define TOD_BASE_YEAR   1988

Earliest year to which an time of day can be initialized.

The following constant define the earliest year to which an time of day can be initialized. This is considered the epoch.

Definition at line 122 of file todimpl.h.

◆ TOD_SECONDS_1970_THROUGH_1988

#define TOD_SECONDS_1970_THROUGH_1988
Value:
(((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \
#define TOD_SECONDS_PER_DAY
Definition: todimpl.h:75
#define TOD_SECONDS_PER_NON_LEAP_YEAR
Definition: todimpl.h:82

Seconds from January 1, 1970 to January 1, 1988. Used to account for differences between POSIX API and RTEMS core. The timespec format time is kept in POSIX compliant form.

Definition at line 111 of file todimpl.h.