ChibiOS/RT  5.1.0
chtime.h File Reference

Time and intervals macros and structures. More...

Go to the source code of this file.

Macros

#define CH_CFG_ST_RESOLUTION   32
 System time counter resolution. More...
 
#define CH_CFG_ST_FREQUENCY   1000
 System tick frequency. More...
 
#define CH_CFG_INTERVALS_SIZE   32
 Time intervals data size. More...
 
#define CH_CFG_TIME_TYPES_SIZE   32
 Time types data size. More...
 
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...
 

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...
 

Functions

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...
 

Detailed Description

Time and intervals macros and structures.

Definition in file chtime.h.