This module is responsible for handling of system time and time intervals.
|
#define | TIME_S2I(secs) |
| Seconds to time interval.
|
#define | TIME_MS2I(msecs) |
| Milliseconds to time interval.
|
#define | TIME_US2I(usecs) |
| Microseconds to time interval.
|
#define | TIME_I2S(interval) |
| Time interval to seconds.
|
#define | TIME_I2MS(interval) |
| Time interval to milliseconds.
|
#define | TIME_I2US(interval) |
| Time interval to microseconds.
|
◆ TIME_IMMEDIATE
Zero interval specification for some functions with a timeout specification.
- Note
- Not all functions accept
TIME_IMMEDIATE
as timeout parameter, see the specific function documentation.
Definition at line 47 of file chtime.h.
Referenced by chCondWaitTimeoutS(), chEvtWaitAllTimeout(), chEvtWaitAllTimeout(), chEvtWaitAnyTimeout(), chEvtWaitAnyTimeout(), chEvtWaitOneTimeout(), chFifoSendObject(), chFifoSendObjectAhead(), chFifoSendObjectAheadS(), chFifoSendObjectS(), chJobPost(), chJobPostAhead(), chJobPostAheadS(), chJobPostS(), chSemWaitTimeoutS(), chThdEnqueueTimeoutS(), chThdSleepS(), chThdSuspendTimeoutS(), chVTDoSetContinuousI(), chVTDoSetI(), i2cMasterReceiveTimeout(), i2cMasterTransmitTimeout(), i2cSlaveReceiveTimeout(), and i2cSlaveTransmitTimeout().
◆ TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
- Note
- Not all functions accept
TIME_INFINITE
as timeout parameter, see the specific function documentation.
Definition at line 55 of file chtime.h.
Referenced by __buffered_serial_get_impl(), __buffered_serial_put_impl(), __buffered_serial_read_impl(), __buffered_serial_write_impl(), __get(), __put(), __read(), __write(), _get(), _get(), _put(), _put(), _read(), _read(), _write(), _write(), adxl317I2CReadRegister(), adxl317I2CWriteRegister(), bmp085I2CReadRegister(), bmp085I2CWriteRegister(), chJobDispatch(), chJobGet(), chMsgSend(), chSchGoSleepTimeoutS(), chThdExit(), chThdWait(), hts221I2CReadRegister(), hts221I2CWriteRegister(), lis3mdlI2CReadRegister(), lis3mdlI2CWriteRegister(), lps22hbI2CReadRegister(), lps25hI2CReadRegister(), lps25hI2CWriteRegister(), lsm303agrI2CReadRegister(), lsm303agrI2CWriteRegister(), lsm303dlhcI2CReadRegister(), lsm303dlhcI2CWriteRegister(), lsm6ds0I2CReadRegister(), lsm6dslI2CReadRegister(), spiExchange(), spiIgnore(), spiReceive(), and spiSend().
◆ TIME_MAX_INTERVAL
◆ TIME_MAX_SYSTIME
Maximum system of system time before it wraps.
Definition at line 65 of file chtime.h.
Referenced by chTimeAddX().
◆ TIME_S2I
Value:
#define CH_CFG_ST_FREQUENCY
System tick frequency.
uint64_t time_conv_t
Type of time conversion variable.
uint64_t sysinterval_t
Type of time interval.
Seconds to time interval.
Converts from seconds to system ticks number.
- Note
- The result is rounded upward to the next tick boundary.
-
Use of this macro for large values is not secure because integer overflows, make sure your value can be correctly converted.
- Parameters
-
[in] | secs | number of seconds |
- Returns
- The number of ticks.
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 185 of file chtime.h.
◆ TIME_MS2I
#define TIME_MS2I |
( |
| msecs | ) |
|
Value:
Milliseconds to time interval.
Converts from milliseconds to system ticks number.
- Note
- The result is rounded upward to the next tick boundary.
-
Use of this macro for large values is not secure because integer overflows, make sure your value can be correctly converted.
- Parameters
-
[in] | msecs | number of milliseconds |
- Returns
- The number of ticks.
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 201 of file chtime.h.
◆ TIME_US2I
#define TIME_US2I |
( |
| usecs | ) |
|
Value:
Microseconds to time interval.
Converts from microseconds to system ticks number.
- Note
- The result is rounded upward to the next tick boundary.
-
Use of this macro for large values is not secure because integer overflows, make sure your value can be correctly converted.
- Parameters
-
[in] | usecs | number of microseconds |
- Returns
- The number of ticks.
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 219 of file chtime.h.
◆ TIME_I2S
#define TIME_I2S |
( |
| interval | ) |
|
Value:
uint32_t time_secs_t
Type of seconds.
Time interval to seconds.
Converts from system ticks number to seconds.
- Note
- The result is rounded up to the next second boundary.
-
Use of this macro for large values is not secure because integer overflows, make sure your value can be correctly converted.
- Parameters
-
[in] | interval | interval in ticks |
- Returns
- The number of seconds.
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 237 of file chtime.h.
◆ TIME_I2MS
#define TIME_I2MS |
( |
| interval | ) |
|
Value:
uint32_t time_msecs_t
Type of milliseconds.
Time interval to milliseconds.
Converts from system ticks number to milliseconds.
- Note
- The result is rounded up to the next millisecond boundary.
-
Use of this macro for large values is not secure because integer overflows, make sure your value can be correctly converted.
- Parameters
-
[in] | interval | interval in ticks |
- Returns
- The number of milliseconds.
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 255 of file chtime.h.
◆ TIME_I2US
#define TIME_I2US |
( |
| interval | ) |
|
Value:
uint32_t time_usecs_t
Type of microseconds.
Time interval to microseconds.
Converts from system ticks number to microseconds.
- Note
- The result is rounded up to the next microsecond boundary.
-
Use of this macro for large values is not secure because integer overflows, make sure your value can be correctly converted.
- Parameters
-
[in] | interval | interval in ticks |
- Returns
- The number of microseconds.
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 273 of file chtime.h.
◆ systime_t
Type of system time.
- Note
- It is selectable in configuration between 16, 32 or 64 bits.
Definition at line 107 of file chtime.h.
◆ sysinterval_t
Type of time interval.
- Note
- It is selectable in configuration between 16, 32 or 64 bits.
Definition at line 119 of file chtime.h.
◆ systimestamp_t
Type of a time stamp.
Definition at line 129 of file chtime.h.
◆ time_secs_t
Type of seconds.
- Note
- It is selectable in configuration between 16 or 32 bits.
Definition at line 136 of file chtime.h.
◆ time_msecs_t
Type of milliseconds.
- Note
- It is selectable in configuration between 16 or 32 bits.
Definition at line 142 of file chtime.h.
◆ time_usecs_t
Type of microseconds.
- Note
- It is selectable in configuration between 16 or 32 bits.
Definition at line 148 of file chtime.h.
◆ time_conv_t
Type of time conversion variable.
- Note
- This type must have double width than other time types, it is only used internally for conversions.
Definition at line 155 of file chtime.h.
◆ chTimeS2I()
Seconds to time interval.
Converts from seconds to system ticks number.
- Note
- The result is rounded upward to the next tick boundary.
- Parameters
-
[in] | secs | number of seconds |
- Returns
- The number of ticks.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 309 of file chtime.h.
References CH_CFG_ST_FREQUENCY, chDbgAssert, and TIME_MAX_INTERVAL.
◆ chTimeMS2I()
Milliseconds to time interval.
Converts from milliseconds to system ticks number.
- Note
- The result is rounded upward to the next tick boundary.
- Parameters
-
[in] | msec | number of milliseconds |
- Returns
- The number of ticks.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 330 of file chtime.h.
References CH_CFG_ST_FREQUENCY, chDbgAssert, and TIME_MAX_INTERVAL.
◆ chTimeUS2I()
Microseconds to time interval.
Converts from microseconds to system ticks number.
- Note
- The result is rounded upward to the next tick boundary.
- Parameters
-
[in] | usec | number of microseconds |
- Returns
- The number of ticks.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 352 of file chtime.h.
References CH_CFG_ST_FREQUENCY, chDbgAssert, and TIME_MAX_INTERVAL.
◆ chTimeI2S()
Time interval to seconds.
Converts from system interval to seconds.
- Note
- The result is rounded up to the next second boundary.
- Parameters
-
[in] | interval | interval in ticks |
- Returns
- The number of seconds.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 374 of file chtime.h.
References CH_CFG_ST_FREQUENCY, and chDbgAssert.
◆ chTimeI2MS()
Time interval to milliseconds.
Converts from system interval to milliseconds.
- Note
- The result is rounded up to the next millisecond boundary.
- Parameters
-
[in] | interval | interval in ticks |
- Returns
- The number of milliseconds.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 397 of file chtime.h.
References CH_CFG_ST_FREQUENCY, and chDbgAssert.
◆ chTimeI2US()
Time interval to microseconds.
Converts from system interval to microseconds.
- Note
- The result is rounded up to the next microsecond boundary.
- Parameters
-
[in] | interval | interval in ticks |
- Returns
- The number of microseconds.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 420 of file chtime.h.
References CH_CFG_ST_FREQUENCY, and chDbgAssert.
◆ chTimeAddX()
Adds an interval to a system time returning a system time.
- Parameters
-
[in] | systime | base system time |
[in] | interval | interval to be added |
- Returns
- The new system time.
- Function Class:
- This is an X-Class API, this function can be invoked from any context.
Definition at line 442 of file chtime.h.
References chDbgCheck, and TIME_MAX_SYSTIME.
◆ chTimeDiffX()
Subtracts two system times returning an interval.
- Parameters
-
[in] | start | first system time |
[in] | end | second system time |
- Returns
- The interval representing the time difference.
- Function Class:
- This is an X-Class API, this function can be invoked from any context.
Definition at line 461 of file chtime.h.
◆ chTimeIsInRangeX()
Checks if the specified time is within the specified time range.
- Note
- When start==end then the function returns always false because the time window has zero size.
- Parameters
-
[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) |
- Return values
-
true | if the current time is within the specified time window. |
false | if the current time is not within the specified time window. |
- Function Class:
- This is an X-Class API, this function can be invoked from any context.
Definition at line 484 of file chtime.h.
Referenced by chThdSleepUntilWindowed(), chVTIsSystemTimeWithin(), and chVTIsSystemTimeWithinX().
◆ chTimeStampAddX()
Adds an interval to a time stamp returning a time stamp.
- Parameters
-
[in] | stamp | base time stamp |
[in] | interval | interval to be added |
- Returns
- The new time stamp.
- Function Class:
- This is an X-Class API, this function can be invoked from any context.
Definition at line 501 of file chtime.h.
◆ chTimeStampDiffX()
Subtracts two time stamps returning an interval.
- Note
- Intervals can then be used for converting in absolute time.
- Parameters
-
[in] | start | first time stamp |
[in] | end | second time stamp |
- Returns
- The interval representing the time stamps difference.
- Function Class:
- This is an X-Class API, this function can be invoked from any context.
Definition at line 517 of file chtime.h.
References chDbgAssert.
◆ chTimeStampIsInRangeX()
Checks if the specified time stamp is within the specified time stamps range.
- Note
- When start==end then the function returns always false because the time window has zero size.
- Parameters
-
[in] | stamp | the time stamp to be verified |
[in] | start | the start of the time stamp window (inclusive) |
[in] | end | the end of the time stamp window (non inclusive) |
- Return values
-
true | if the current time stamp is within the specified time stamp window. |
false | if the current time stamp is not within the specified time stamp window. |
- Function Class:
- This is an X-Class API, this function can be invoked from any context.
Definition at line 552 of file chtime.h.