ChibiOS/RT
6.0.3
|
This module is responsible for handling of system time and time intervals.
Special time constants | |
#define | TIME_IMMEDIATE ((sysinterval_t)0) |
Zero interval specification for some functions with a timeout specification. More... | |
#define | TIME_INFINITE ((sysinterval_t)-1) |
Infinite interval specification for all functions with a timeout specification. More... | |
#define | TIME_MAX_INTERVAL ((sysinterval_t)-2) |
Maximum interval constant usable as timeout. More... | |
#define | TIME_MAX_SYSTIME ((systime_t)-1) |
Maximum system of system time before it wraps. More... | |
Fast time conversion utilities | |
#define | TIME_S2I(secs) ((sysinterval_t)((time_conv_t)(secs) * (time_conv_t)CH_CFG_ST_FREQUENCY)) |
Seconds to time interval. More... | |
#define | TIME_MS2I(msecs) |
Milliseconds to time interval. More... | |
#define | TIME_US2I(usecs) |
Microseconds to time interval. More... | |
#define | TIME_I2S(interval) |
Time interval to seconds. More... | |
#define | TIME_I2MS(interval) |
Time interval to milliseconds. More... | |
#define | TIME_I2US(interval) |
Time interval to microseconds. More... | |
Secure time conversion utilities | |
static sysinterval_t | chTimeS2I (time_secs_t secs) |
Seconds to time interval. More... | |
static sysinterval_t | chTimeMS2I (time_msecs_t msec) |
Milliseconds to time interval. More... | |
static sysinterval_t | chTimeUS2I (time_usecs_t usec) |
Microseconds to time interval. More... | |
static time_secs_t | chTimeI2S (sysinterval_t interval) |
Time interval to seconds. More... | |
static time_msecs_t | chTimeI2MS (sysinterval_t interval) |
Time interval to milliseconds. More... | |
static time_usecs_t | chTimeI2US (sysinterval_t interval) |
Time interval to microseconds. More... | |
static systime_t | chTimeAddX (systime_t systime, sysinterval_t interval) |
Adds an interval to a system time returning a system time. More... | |
static sysinterval_t | chTimeDiffX (systime_t start, systime_t end) |
Subtracts two system times returning an interval. More... | |
static bool | chTimeIsInRangeX (systime_t time, systime_t start, systime_t end) |
Checks if the specified time is within the specified time range. More... | |
Typedefs | |
typedef uint64_t | systime_t |
Type of system time. More... | |
typedef uint64_t | sysinterval_t |
Type of time interval. More... | |
typedef uint32_t | time_secs_t |
Type of seconds. More... | |
typedef uint32_t | time_msecs_t |
Type of milliseconds. More... | |
typedef uint32_t | time_usecs_t |
Type of microseconds. More... | |
typedef uint64_t | time_conv_t |
Type of time conversion variable. More... | |
#define TIME_IMMEDIATE ((sysinterval_t)0) |
Zero interval specification for some functions with a timeout specification.
TIME_IMMEDIATE
as timeout parameter, see the specific function documentation. Definition at line 47 of file chtime.h.
Referenced by chCondWaitTimeoutS(), chEvtWaitAllTimeout(), chEvtWaitAnyTimeout(), chEvtWaitOneTimeout(), chFifoSendObject(), chFifoSendObjectAhead(), chFifoSendObjectAheadS(), chFifoSendObjectS(), chSemWaitTimeoutS(), chThdEnqueueTimeoutS(), chThdSleepS(), chThdSuspendTimeoutS(), and chVTDoSetI().
#define TIME_INFINITE ((sysinterval_t)-1) |
Infinite interval specification for all functions with a timeout specification.
TIME_INFINITE
as timeout parameter, see the specific function documentation. Definition at line 55 of file chtime.h.
Referenced by chSchGoSleepTimeoutS().
#define TIME_MAX_INTERVAL ((sysinterval_t)-2) |
Maximum interval constant usable as timeout.
Definition at line 60 of file chtime.h.
Referenced by chTimeMS2I(), chTimeS2I(), and chTimeUS2I().
#define TIME_MAX_SYSTIME ((systime_t)-1) |
Maximum system of system time before it wraps.
Definition at line 65 of file chtime.h.
Referenced by chTimeAddX(), chVTDoResetI(), chVTDoSetI(), and chVTDoTickI().
#define TIME_S2I | ( | secs | ) | ((sysinterval_t)((time_conv_t)(secs) * (time_conv_t)CH_CFG_ST_FREQUENCY)) |
Seconds to time interval.
Converts from seconds to system ticks number.
[in] | secs | number of seconds |
#define TIME_MS2I | ( | msecs | ) |
Milliseconds to time interval.
Converts from milliseconds to system ticks number.
[in] | msecs | number of milliseconds |
#define TIME_US2I | ( | usecs | ) |
Microseconds to time interval.
Converts from microseconds to system ticks number.
[in] | usecs | number of microseconds |
#define TIME_I2S | ( | interval | ) |
Time interval to seconds.
Converts from system ticks number to seconds.
[in] | interval | interval in ticks |
#define TIME_I2MS | ( | interval | ) |
Time interval to milliseconds.
Converts from system ticks number to milliseconds.
[in] | interval | interval in ticks |
#define TIME_I2US | ( | interval | ) |
Time interval to microseconds.
Converts from system ticks number to microseconds.
[in] | interval | interval in ticks |
typedef uint64_t systime_t |
typedef uint64_t sysinterval_t |
typedef uint32_t time_secs_t |
typedef uint32_t time_msecs_t |
typedef uint32_t time_usecs_t |
typedef uint64_t time_conv_t |
|
inlinestatic |
Seconds to time interval.
Converts from seconds to system ticks number.
[in] | secs | number of seconds |
Definition at line 307 of file chtime.h.
References CH_CFG_ST_FREQUENCY, chDbgAssert, and TIME_MAX_INTERVAL.
|
inlinestatic |
Milliseconds to time interval.
Converts from milliseconds to system ticks number.
[in] | msec | number of milliseconds |
Definition at line 328 of file chtime.h.
References CH_CFG_ST_FREQUENCY, chDbgAssert, and TIME_MAX_INTERVAL.
|
inlinestatic |
Microseconds to time interval.
Converts from microseconds to system ticks number.
[in] | usec | number of microseconds |
Definition at line 350 of file chtime.h.
References CH_CFG_ST_FREQUENCY, chDbgAssert, and TIME_MAX_INTERVAL.
|
inlinestatic |
Time interval to seconds.
Converts from system interval to seconds.
[in] | interval | interval in ticks |
Definition at line 372 of file chtime.h.
References CH_CFG_ST_FREQUENCY, and chDbgAssert.
|
inlinestatic |
Time interval to milliseconds.
Converts from system interval to milliseconds.
[in] | interval | interval in ticks |
Definition at line 395 of file chtime.h.
References CH_CFG_ST_FREQUENCY, and chDbgAssert.
|
inlinestatic |
Time interval to microseconds.
Converts from system interval to microseconds.
[in] | interval | interval in ticks |
Definition at line 418 of file chtime.h.
References CH_CFG_ST_FREQUENCY, and chDbgAssert.
|
inlinestatic |
Adds an interval to a system time returning a system time.
[in] | systime | base system time |
[in] | interval | interval to be added |
Definition at line 440 of file chtime.h.
References chDbgCheck, and TIME_MAX_SYSTIME.
Referenced by chVTDoResetI(), chVTDoSetI(), and chVTDoTickI().
|
inlinestatic |
Subtracts two system times returning an interval.
[in] | start | first system time |
[in] | end | second system time |
Definition at line 459 of file chtime.h.
Referenced by chThdSleepUntil(), chThdSleepUntilWindowed(), chVTDoResetI(), chVTDoSetI(), chVTDoTickI(), chVTGetTimersStateI(), and chVTTimeElapsedSinceX().
Checks if the specified time is within the specified time range.
[in] | time | the time to be verified |
[in] | start | the start of the time window (inclusive) |
[in] | end | the end of the time window (non inclusive) |
true | current time within the specified time window. |
false | current time not within the specified time window. |
Definition at line 480 of file chtime.h.
Referenced by chThdSleepUntilWindowed(), chVTIsSystemTimeWithin(), and chVTIsSystemTimeWithinX().