RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Modules | Files | Data Structures | Macros | Functions | Variables
Time of Day Handler

This group contains the Time of Day Handler implementation. More...

Modules

 Time of Day Handler Action Hooks
 This group contains the implementation to support Time of Day Handler action hooks.
 

Files

file  todimpl.h
 This header file provides the interfaces of the Time of Day Handler and the Time of Day Handler Action Hooks.
 
file  coretod.c
 This source file contains the definition of _TOD and the implementation of _TOD_Lock(), _TOD_Unlock(), and _TOD_Is_owner().
 
file  coretodcheck.c
 This source file contains the implementation of _TOD_Is_valid_new_time_of_day().
 
file  coretodset.c
 This source file contains the implementation of _TOD_Set().
 

Data Structures

struct  TOD_Control
 TOD control. 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_TICKS_PER_SECOND   _Watchdog_Ticks_per_second
 Gets number of ticks in a second.
 

Functions

void _TOD_Lock (void)
 Locks the time of day mutex.
 
void _TOD_Unlock (void)
 Unlocks the time of day mutex.
 
Status_Control _TOD_Is_valid_new_time_of_day (const struct timespec *tod)
 Checks the time point is a valid new time of day for _TOD_Set().
 
Status_Control _TOD_Set (const struct timespec *tod, ISR_lock_Context *lock_context)
 Sets the time of day.
 

Variables

TOD_Control _TOD
 TOD Management information.
 
const uint16_t _TOD_Days_to_date [2][13]
 This array contains the number of days in all months up to the month indicated by the index of the second dimension.
 

Detailed Description

This group contains the Time of Day Handler implementation.

The following constants are related to the time of day and are independent of RTEMS.

This handler encapsulates functionality used to manage time of day.

Macro Definition Documentation

◆ TOD_DAYS_PER_YEAR

#define TOD_DAYS_PER_YEAR   (uint32_t)365

This constant represents the number of days in a non-leap year.

◆ TOD_HOURS_PER_DAY

#define TOD_HOURS_PER_DAY   (uint32_t)24

This constant represents the number of hours per day.

◆ TOD_MICROSECONDS_PER_SECOND

#define TOD_MICROSECONDS_PER_SECOND   (uint32_t)1000000

This constant represents the number of microseconds in a second.

◆ TOD_MILLISECONDS_PER_SECOND

#define TOD_MILLISECONDS_PER_SECOND   (uint32_t)1000

This constant represents the number of millisecond in a second.

◆ TOD_MINUTES_PER_HOUR

#define TOD_MINUTES_PER_HOUR   (uint32_t)60

This constant represents the number of minutes per hour.

◆ TOD_MONTHS_PER_YEAR

#define TOD_MONTHS_PER_YEAR   (uint32_t)12

This constant represents the number of months in a year.

◆ TOD_NANOSECONDS_PER_MICROSECOND

#define TOD_NANOSECONDS_PER_MICROSECOND   (uint32_t)1000

This constant represents the number of nanoseconds in a mircosecond.

◆ TOD_NANOSECONDS_PER_SECOND

#define TOD_NANOSECONDS_PER_SECOND   (uint32_t)1000000000

This constant represents the number of nanoseconds in a second.

◆ TOD_SECONDS_PER_DAY

#define TOD_SECONDS_PER_DAY
Value:
(uint32_t) (TOD_SECONDS_PER_MINUTE * \
#define TOD_MINUTES_PER_HOUR
Definition: todimpl.h:76
#define TOD_SECONDS_PER_MINUTE
Definition: todimpl.h:71
#define TOD_HOURS_PER_DAY
Definition: todimpl.h:91

This constant represents the number of seconds in a day which does not include a leap second.

◆ TOD_SECONDS_PER_MINUTE

#define TOD_SECONDS_PER_MINUTE   (uint32_t)60

This constant represents the number of seconds in a minute.

◆ TOD_SECONDS_PER_NON_LEAP_YEAR

#define TOD_SECONDS_PER_NON_LEAP_YEAR   (365 * TOD_SECONDS_PER_DAY)

This constant represents the number of seconds in a non-leap year.

Function Documentation

◆ _TOD_Is_valid_new_time_of_day()

Status_Control _TOD_Is_valid_new_time_of_day ( const struct timespec *  tod)

Checks the time point is a valid new time of day for _TOD_Set().

Parameters
todthe time of day to check.
Return values
STATUS_SUCCESSFULThe time of day is valid.
STATUS_INVALID_NUMBERThe time of day is invalid.

◆ _TOD_Set()

Status_Control _TOD_Set ( const struct timespec *  tod,
ISR_lock_Context lock_context 
)

Sets the time of day.

The caller must be the owner of the TOD lock.

Parameters
todThe new time of day in timespec format representing the time since UNIX Epoch. The new time of day shall be valid according to _TOD_Is_valid_new_time_of_day().
lock_contextThe ISR lock context used for the corresponding _TOD_Acquire(). The caller must be the owner of the TOD lock. This function will release the TOD lock.
Return values
STATUS_SUCCESSFULSuccessful operation.
otherSome error occurred.

Variable Documentation

◆ _TOD_Days_to_date

const uint16_t _TOD_Days_to_date[2][13]
extern

This array contains the number of days in all months up to the month indicated by the index of the second dimension.

The first dimension should be 0 for leap years, and 1 otherwise.