RTEMS  5.0.0
Files | Macros | Functions
Clocks

Files

file  clock.h
 
file  clockgetsecondssinceepoch.c
 Obtain Seconds Since Epoch.
 
file  clockgettickspersecond.c
 Obtain Ticks Per Seconds.
 
file  clockgettod.c
 Obtain Current Time of Day (Classic TOD)
 
file  clockgettodtimeval.c
 Obtain TOD in struct timeval Format.
 
file  clockgetuptime.c
 Obtain the System Uptime.
 
file  clockgetuptimenanoseconds.c
 Returns the system uptime in seconds.
 
file  clockgetuptimeseconds.c
 
file  clockgetuptimetimeval.c
 Gets the System Uptime in the Struct Timeval Format.
 
file  clockset.c
 Set the Current TOD.
 
file  clocktick.c
 Announce a Clock Tick.
 
file  clocktodtoseconds.c
 TOD to Seconds.
 
file  clocktodvalidate.c
 TOD Validate.
 
file  rtclock.c
 No Initialization Routine.
 

Macros

#define rtems_clock_get_ticks_per_second(void)   ( _Watchdog_Ticks_per_second )
 Obtain Ticks Per Seconds. More...
 

Functions

rtems_status_code rtems_clock_get_tod (rtems_time_of_day *time_buffer)
 Obtain Current Time of Day (Classic TOD) More...
 
rtems_status_code rtems_clock_get_tod_timeval (struct timeval *time)
 Obtain TOD in struct timeval Format. More...
 
rtems_status_code rtems_clock_get_seconds_since_epoch (rtems_interval *the_interval)
 Obtain Seconds Since Epoch. More...
 
RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_get_ticks_since_boot (void)
 Gets the current ticks counter value. More...
 
RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_tick_later (rtems_interval delta)
 Returns the ticks counter value delta ticks in the future. More...
 
RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_tick_later_usec (rtems_interval delta_in_usec)
 Returns the ticks counter value at least delta microseconds in the future. More...
 
RTEMS_INLINE_ROUTINE bool rtems_clock_tick_before (rtems_interval tick)
 Returns true if the current ticks counter value indicates a time before the time specified by the tick value and false otherwise. More...
 
rtems_status_code rtems_clock_set (const rtems_time_of_day *time_buffer)
 Set the Current TOD. More...
 
rtems_status_code rtems_clock_tick (void)
 Announce a Clock Tick. More...
 
rtems_status_code rtems_clock_get_uptime (struct timespec *uptime)
 Obtain the System Uptime. More...
 
void rtems_clock_get_uptime_timeval (struct timeval *uptime)
 Gets the System Uptime in the Struct Timeval Format. More...
 
time_t rtems_clock_get_uptime_seconds (void)
 Returns the system uptime in seconds. More...
 
uint64_t rtems_clock_get_uptime_nanoseconds (void)
 Returns the system uptime in nanoseconds. More...
 
bool _TOD_Validate (const rtems_time_of_day *the_tod)
 TOD Validate. More...
 
Watchdog_Interval _TOD_To_seconds (const rtems_time_of_day *the_tod)
 TOD to Seconds. More...
 

Detailed Description

This encapsulates functionality related to the Classic API Clock Manager.

Macro Definition Documentation

◆ rtems_clock_get_ticks_per_second

rtems_interval rtems_clock_get_ticks_per_second (   void)    ( _Watchdog_Ticks_per_second )

Obtain Ticks Per Seconds.

This routine implements the rtems_clock_get_ticks_per_second directive.

Return values
Thismethod returns the number of ticks per second. It cannot fail since RTEMS is always configured to know the number of ticks per second.

Function Documentation

◆ _TOD_To_seconds()

Watchdog_Interval _TOD_To_seconds ( const rtems_time_of_day the_tod)

TOD to Seconds.

This function returns the number seconds between the epoch and the_tod.

Parameters
[in]the_todis the TOD structure to convert to seconds
Return values
Thismethod returns the number of seconds since epoch represented by the_tod

◆ _TOD_Validate()

bool _TOD_Validate ( const rtems_time_of_day the_tod)

TOD Validate.

This support function returns true if the_tod contains a valid time of day, and false otherwise.

Parameters
[in]the_todis the TOD structure to validate
Return values
Thismethod returns true if the TOD is valid and false otherwise.
Note
This routine only works for leap-years through 2099.

◆ rtems_clock_get_seconds_since_epoch()

rtems_status_code rtems_clock_get_seconds_since_epoch ( rtems_interval the_interval)

Obtain Seconds Since Epoch.

This routine implements the rtems_clock_get_seconds_since_epoch directive.

Parameters
[in]the_intervalpoints to the interval variable to fill in
Return values
Thismethod returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the time_buffer will be filled in with the current time of day.

◆ rtems_clock_get_ticks_since_boot()

RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_get_ticks_since_boot ( void  )

Gets the current ticks counter value.

Returns
The current tick counter value. With a 1ms clock tick, this counter overflows after 50 days since boot.

◆ rtems_clock_get_tod()

rtems_status_code rtems_clock_get_tod ( rtems_time_of_day time_buffer)

Obtain Current Time of Day (Classic TOD)

This routine implements the rtems_clock_get_tod directive. It returns the current time of day in the format defined by RTEID.

Clock Manager - rtems_clock_get_tod

Parameters
[in]time_bufferpoints to the time of day structure
Return values
Thismethod returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the time_buffer will be filled in with the current time of day.

◆ rtems_clock_get_tod_timeval()

rtems_status_code rtems_clock_get_tod_timeval ( struct timeval *  time)

Obtain TOD in struct timeval Format.

This routine implements the rtems_clock_get_tod_timeval directive.

Parameters
[in]timepoints to the struct timeval variable to fill in
Return values
Thismethod returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the time will be filled in with the current time of day.

◆ rtems_clock_get_uptime()

rtems_status_code rtems_clock_get_uptime ( struct timespec *  uptime)

Obtain the System Uptime.

This directive returns the system uptime.

Parameters
[in]uptimeis a pointer to the time structure
Return values
Thismethod returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the uptime will be filled in.

◆ rtems_clock_get_uptime_nanoseconds()

uint64_t rtems_clock_get_uptime_nanoseconds ( void  )

Returns the system uptime in nanoseconds.

Return values
Thesystem uptime in nanoseconds.

◆ rtems_clock_get_uptime_seconds()

time_t rtems_clock_get_uptime_seconds ( void  )

Returns the system uptime in seconds.

Return values
Thesystem uptime in seconds.

◆ rtems_clock_get_uptime_timeval()

void rtems_clock_get_uptime_timeval ( struct timeval *  uptime)

Gets the System Uptime in the Struct Timeval Format.

Parameters
[out]uptimeis a pointer to a struct timeval structure.
Return values
Thismethods returns the system uptime.
Note
Pointer must not be NULL.

◆ rtems_clock_set()

rtems_status_code rtems_clock_set ( const rtems_time_of_day time_buffer)

Set the Current TOD.

This routine implements the rtems_clock_set directive. It sets the current time of day to that in the time_buffer record.

Parameters
[in]time_bufferpoints to the new TOD
Return values
Thismethod returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error.
Note
Activities scheduled based upon the current time of day may be executed immediately if the time is moved forward.

◆ rtems_clock_tick()

rtems_status_code rtems_clock_tick ( void  )

Announce a Clock Tick.

This routine implements the rtems_clock_tick directive. It is invoked to inform RTEMS of the occurrence of a clock tick.

Return values
Thisdirective always returns RTEMS_SUCCESSFUL.
Note
This method is typically called from an ISR and is the basis for all timeouts and delays. This routine only works for leap-years through 2099.

◆ rtems_clock_tick_before()

RTEMS_INLINE_ROUTINE bool rtems_clock_tick_before ( rtems_interval  tick)

Returns true if the current ticks counter value indicates a time before the time specified by the tick value and false otherwise.

Parameters
[in]tickThe tick value.

This can be used to write busy loops with a timeout.

status busy( void )
{
do {
if ( ok() ) {
return success;
}
} while ( rtems_clock_tick_before( timeout ) );
return timeout;
}
Return values
trueThe current ticks counter value indicates a time before the time specified by the tick value.
falseOtherwise.

◆ rtems_clock_tick_later()

RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_tick_later ( rtems_interval  delta)

Returns the ticks counter value delta ticks in the future.

Parameters
[in]deltaThe ticks delta value.
Returns
The tick counter value delta ticks in the future.

◆ rtems_clock_tick_later_usec()

RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_tick_later_usec ( rtems_interval  delta_in_usec)

Returns the ticks counter value at least delta microseconds in the future.

Parameters
[in]delta_in_usecThe delta value in microseconds.
Returns
The tick counter value at least delta microseconds in the future.