Go to the documentation of this file.
47 #define TIME_IMMEDIATE ((sysinterval_t)0)
55 #define TIME_INFINITE ((sysinterval_t)-1)
60 #define TIME_MAX_INTERVAL ((sysinterval_t)-2)
65 #define TIME_MAX_SYSTIME ((systime_t)-1)
76 #if (CH_CFG_ST_RESOLUTION != 16) && (CH_CFG_ST_RESOLUTION != 32) && \
77 (CH_CFG_ST_RESOLUTION != 64)
78 #error "invalid CH_CFG_ST_RESOLUTION specified, must be 16, 32 or 64"
81 #if CH_CFG_ST_FREQUENCY < 10
82 #error "invalid CH_CFG_ST_FREQUENCY specified, must be >= 10"
85 #if (CH_CFG_INTERVALS_SIZE != 16) && (CH_CFG_INTERVALS_SIZE != 32) && \
86 (CH_CFG_INTERVALS_SIZE != 64)
87 #error "invalid CH_CFG_INTERVALS_SIZE specified, must be 16, 32 or 64"
90 #if (CH_CFG_TIME_TYPES_SIZE != 16) && (CH_CFG_TIME_TYPES_SIZE != 32)
91 #error "invalid CH_CFG_TIME_TYPES_SIZE specified, must be 16 or 32"
94 #if CH_CFG_INTERVALS_SIZE < CH_CFG_ST_RESOLUTION
95 #error "CH_CFG_INTERVALS_SIZE must be >= CH_CFG_ST_RESOLUTION"
106 #if (CH_CFG_ST_RESOLUTION == 64) || defined(__DOXYGEN__)
108 #elif CH_CFG_ST_RESOLUTION == 32
110 #elif CH_CFG_ST_RESOLUTION == 16
118 #if (CH_CFG_INTERVALS_SIZE == 64) || defined(__DOXYGEN__)
120 #elif CH_CFG_INTERVALS_SIZE == 32
122 #elif CH_CFG_INTERVALS_SIZE == 16
131 #if (CH_CFG_TIME_TYPES_SIZE == 32) || defined(__DOXYGEN__)
185 #define TIME_S2I(secs) \
186 ((sysinterval_t)((time_conv_t)(secs) * (time_conv_t)CH_CFG_ST_FREQUENCY))
201 #define TIME_MS2I(msecs) \
202 ((sysinterval_t)((((time_conv_t)(msecs) * \
203 (time_conv_t)CH_CFG_ST_FREQUENCY) + \
204 (time_conv_t)999) / (time_conv_t)1000))
219 #define TIME_US2I(usecs) \
220 ((sysinterval_t)((((time_conv_t)(usecs) * \
221 (time_conv_t)CH_CFG_ST_FREQUENCY) + \
222 (time_conv_t)999999) / (time_conv_t)1000000))
237 #define TIME_I2S(interval) \
238 (time_secs_t)(((time_conv_t)(interval) + \
239 (time_conv_t)CH_CFG_ST_FREQUENCY - \
240 (time_conv_t)1) / (time_conv_t)CH_CFG_ST_FREQUENCY)
255 #define TIME_I2MS(interval) \
256 (time_msecs_t)((((time_conv_t)(interval) * (time_conv_t)1000) + \
257 (time_conv_t)CH_CFG_ST_FREQUENCY - (time_conv_t)1) / \
258 (time_conv_t)CH_CFG_ST_FREQUENCY)
273 #define TIME_I2US(interval) \
274 (time_msecs_t)((((time_conv_t)(interval) * (time_conv_t)1000000) + \
275 (time_conv_t)CH_CFG_ST_FREQUENCY - (time_conv_t)1) / \
276 (time_conv_t)CH_CFG_ST_FREQUENCY)
315 "conversion overflow");
337 "conversion overflow");
359 "conversion overflow");
382 "conversion overflow");
405 "conversion overflow");
428 "conversion overflow");
445 #if CH_CFG_ST_RESOLUTION != CH_CFG_INTERVALS_SIZE
525 "conversion overflow");
uint32_t time_secs_t
Type of seconds.
uint64_t systime_t
Type of system time.
#define chDbgAssert(c, r)
Condition assertion.
uint32_t time_usecs_t
Type of microseconds.
static sysinterval_t chTimeDiffX(systime_t start, systime_t end)
Subtracts two system times returning an interval.
uint64_t systimestamp_t
Type of a time stamp.
#define CH_CFG_ST_FREQUENCY
System tick frequency.
static sysinterval_t chTimeMS2I(time_msecs_t msec)
Milliseconds to time interval.
#define TIME_MAX_INTERVAL
Maximum interval constant usable as timeout.
#define chDbgCheck(c)
Function parameters check.
static time_secs_t chTimeI2S(sysinterval_t interval)
Time interval to seconds.
static sysinterval_t chTimeUS2I(time_usecs_t usec)
Microseconds to time interval.
static systime_t chTimeAddX(systime_t systime, sysinterval_t interval)
Adds an interval to a system time returning a system time.
static time_msecs_t chTimeI2MS(sysinterval_t interval)
Time interval to milliseconds.
static time_usecs_t chTimeI2US(sysinterval_t interval)
Time interval to microseconds.
static sysinterval_t chTimeStampDiffX(systimestamp_t start, systimestamp_t end)
Subtracts two time stamps returning an interval.
uint32_t time_msecs_t
Type of milliseconds.
static systimestamp_t chTimeStampAddX(systimestamp_t stamp, sysinterval_t interval)
Adds an interval to a time stamp returning a time stamp.
uint64_t sysinterval_t
Type of time interval.
#define TIME_MAX_SYSTIME
Maximum system of system time before it wraps.
uint64_t time_conv_t
Type of time conversion variable.
static sysinterval_t chTimeS2I(time_secs_t secs)
Seconds to time interval.
static bool chTimeStampIsInRangeX(systimestamp_t stamp, systimestamp_t start, systimestamp_t end)
Checks if the specified time stamp is within the specified time stamps range.
static bool chTimeIsInRangeX(systime_t time, systime_t start, systime_t end)
Checks if the specified time is within the specified time range.