Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Time Units Helpers

Various helper APIs for converting between time units. More...

Macros

#define SYS_FOREVER_MS   (-1)
 System-wide macro to denote "forever" in milliseconds.
 
#define SYS_FOREVER_US   (-1)
 System-wide macro to denote "forever" in microseconds.
 
#define SYS_TIMEOUT_MS(ms)
 System-wide macro to convert milliseconds to kernel timeouts.
 
#define TIME_CONSTEXPR
 
#define sys_clock_hw_cycles_per_sec()   CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
 Get the system timer frequency.
 
#define k_ms_to_cyc_floor32(t)    z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, false)
 Convert milliseconds to hardware cycles.
 
#define k_ms_to_cyc_floor64(t)    z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, false)
 Convert milliseconds to hardware cycles.
 
#define k_ms_to_cyc_near32(t)    z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, true)
 Convert milliseconds to hardware cycles.
 
#define k_ms_to_cyc_near64(t)    z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, true)
 Convert milliseconds to hardware cycles.
 
#define k_ms_to_cyc_ceil32(t)    z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, true, false)
 Convert milliseconds to hardware cycles.
 
#define k_ms_to_cyc_ceil64(t)    z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, true, false)
 Convert milliseconds to hardware cycles.
 
#define k_ms_to_ticks_floor32(t)    z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, false, false)
 Convert milliseconds to ticks.
 
#define k_ms_to_ticks_floor64(t)    z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, false, false)
 Convert milliseconds to ticks.
 
#define k_ms_to_ticks_near32(t)    z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, false, true)
 Convert milliseconds to ticks.
 
#define k_ms_to_ticks_near64(t)    z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, false, true)
 Convert milliseconds to ticks.
 
#define k_ms_to_ticks_ceil32(t)    z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, true, false)
 Convert milliseconds to ticks.
 
#define k_ms_to_ticks_ceil64(t)    z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, true, false)
 Convert milliseconds to ticks.
 
#define k_us_to_cyc_floor32(t)    z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, false)
 Convert microseconds to hardware cycles.
 
#define k_us_to_cyc_floor64(t)    z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, false)
 Convert microseconds to hardware cycles.
 
#define k_us_to_cyc_near32(t)    z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, true)
 Convert microseconds to hardware cycles.
 
#define k_us_to_cyc_near64(t)    z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, true)
 Convert microseconds to hardware cycles.
 
#define k_us_to_cyc_ceil32(t)    z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, true, false)
 Convert microseconds to hardware cycles.
 
#define k_us_to_cyc_ceil64(t)    z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, true, false)
 Convert microseconds to hardware cycles.
 
#define k_us_to_ticks_floor32(t)    z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, false, false)
 Convert microseconds to ticks.
 
#define k_us_to_ticks_floor64(t)    z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, false, false)
 Convert microseconds to ticks.
 
#define k_us_to_ticks_near32(t)    z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, false, true)
 Convert microseconds to ticks.
 
#define k_us_to_ticks_near64(t)    z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, false, true)
 Convert microseconds to ticks.
 
#define k_us_to_ticks_ceil32(t)    z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, true, false)
 Convert microseconds to ticks.
 
#define k_us_to_ticks_ceil64(t)    z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, true, false)
 Convert microseconds to ticks.
 
#define k_ns_to_cyc_floor32(t)    z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, false)
 Convert nanoseconds to hardware cycles.
 
#define k_ns_to_cyc_floor64(t)    z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, false)
 Convert nanoseconds to hardware cycles.
 
#define k_ns_to_cyc_near32(t)    z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, true)
 Convert nanoseconds to hardware cycles.
 
#define k_ns_to_cyc_near64(t)    z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, true)
 Convert nanoseconds to hardware cycles.
 
#define k_ns_to_cyc_ceil32(t)    z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, true, false)
 Convert nanoseconds to hardware cycles.
 
#define k_ns_to_cyc_ceil64(t)    z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, true, false)
 Convert nanoseconds to hardware cycles.
 
#define k_ns_to_ticks_floor32(t)    z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, false, false)
 Convert nanoseconds to ticks.
 
#define k_ns_to_ticks_floor64(t)    z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, false, false)
 Convert nanoseconds to ticks.
 
#define k_ns_to_ticks_near32(t)    z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, false, true)
 Convert nanoseconds to ticks.
 
#define k_ns_to_ticks_near64(t)    z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, false, true)
 Convert nanoseconds to ticks.
 
#define k_ns_to_ticks_ceil32(t)    z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, true, false)
 Convert nanoseconds to ticks.
 
#define k_ns_to_ticks_ceil64(t)    z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, true, false)
 Convert nanoseconds to ticks.
 
#define k_cyc_to_ms_floor32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, false)
 Convert hardware cycles to milliseconds.
 
#define k_cyc_to_ms_floor64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, false)
 Convert hardware cycles to milliseconds.
 
#define k_cyc_to_ms_near32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, true)
 Convert hardware cycles to milliseconds.
 
#define k_cyc_to_ms_near64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, true)
 Convert hardware cycles to milliseconds.
 
#define k_cyc_to_ms_ceil32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, true, false)
 Convert hardware cycles to milliseconds.
 
#define k_cyc_to_ms_ceil64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, true, false)
 Convert hardware cycles to milliseconds.
 
#define k_cyc_to_us_floor32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, false)
 Convert hardware cycles to microseconds.
 
#define k_cyc_to_us_floor64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, false)
 Convert hardware cycles to microseconds.
 
#define k_cyc_to_us_near32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, true)
 Convert hardware cycles to microseconds.
 
#define k_cyc_to_us_near64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, true)
 Convert hardware cycles to microseconds.
 
#define k_cyc_to_us_ceil32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, true, false)
 Convert hardware cycles to microseconds.
 
#define k_cyc_to_us_ceil64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, true, false)
 Convert hardware cycles to microseconds.
 
#define k_cyc_to_ns_floor32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, false)
 Convert hardware cycles to nanoseconds.
 
#define k_cyc_to_ns_floor64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, false)
 Convert hardware cycles to nanoseconds.
 
#define k_cyc_to_ns_near32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, true)
 Convert hardware cycles to nanoseconds.
 
#define k_cyc_to_ns_near64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, true)
 Convert hardware cycles to nanoseconds.
 
#define k_cyc_to_ns_ceil32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, true, false)
 Convert hardware cycles to nanoseconds.
 
#define k_cyc_to_ns_ceil64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, true, false)
 Convert hardware cycles to nanoseconds.
 
#define k_cyc_to_ticks_floor32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, false)
 Convert hardware cycles to ticks.
 
#define k_cyc_to_ticks_floor64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, false)
 Convert hardware cycles to ticks.
 
#define k_cyc_to_ticks_near32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, true)
 Convert hardware cycles to ticks.
 
#define k_cyc_to_ticks_near64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, true)
 Convert hardware cycles to ticks.
 
#define k_cyc_to_ticks_ceil32(t)    z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, false)
 Convert hardware cycles to ticks.
 
#define k_cyc_to_ticks_ceil64(t)    z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, false)
 Convert hardware cycles to ticks.
 
#define k_ticks_to_ms_floor32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, false, false)
 Convert ticks to milliseconds.
 
#define k_ticks_to_ms_floor64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, false, false)
 Convert ticks to milliseconds.
 
#define k_ticks_to_ms_near32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, false, true)
 Convert ticks to milliseconds.
 
#define k_ticks_to_ms_near64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, false, true)
 Convert ticks to milliseconds.
 
#define k_ticks_to_ms_ceil32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, true, false)
 Convert ticks to milliseconds.
 
#define k_ticks_to_ms_ceil64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, true, false)
 Convert ticks to milliseconds.
 
#define k_ticks_to_us_floor32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, false, false)
 Convert ticks to microseconds.
 
#define k_ticks_to_us_floor64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, false, false)
 Convert ticks to microseconds.
 
#define k_ticks_to_us_near32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, false, true)
 Convert ticks to microseconds.
 
#define k_ticks_to_us_near64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, false, true)
 Convert ticks to microseconds.
 
#define k_ticks_to_us_ceil32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, true, false)
 Convert ticks to microseconds.
 
#define k_ticks_to_us_ceil64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, true, false)
 Convert ticks to microseconds.
 
#define k_ticks_to_ns_floor32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, false, false)
 Convert ticks to nanoseconds.
 
#define k_ticks_to_ns_floor64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, false, false)
 Convert ticks to nanoseconds.
 
#define k_ticks_to_ns_near32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, false, true)
 Convert ticks to nanoseconds.
 
#define k_ticks_to_ns_near64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, false, true)
 Convert ticks to nanoseconds.
 
#define k_ticks_to_ns_ceil32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, true, false)
 Convert ticks to nanoseconds.
 
#define k_ticks_to_ns_ceil64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, true, false)
 Convert ticks to nanoseconds.
 
#define k_ticks_to_cyc_floor32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, false)
 Convert ticks to hardware cycles.
 
#define k_ticks_to_cyc_floor64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, false)
 Convert ticks to hardware cycles.
 
#define k_ticks_to_cyc_near32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, true)
 Convert ticks to hardware cycles.
 
#define k_ticks_to_cyc_near64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, true)
 Convert ticks to hardware cycles.
 
#define k_ticks_to_cyc_ceil32(t)    z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, true, false)
 Convert ticks to hardware cycles.
 
#define k_ticks_to_cyc_ceil64(t)    z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, true, false)
 Convert ticks to hardware cycles.
 

Detailed Description

Various helper APIs for converting between time units.

Macro Definition Documentation

◆ k_cyc_to_ms_ceil32

#define k_cyc_to_ms_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to milliseconds.

32 bits. Rounds up.

Converts time values in hardware cycles to milliseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_cyc_to_ms_ceil64

#define k_cyc_to_ms_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to milliseconds.

64 bits. Rounds up.

Converts time values in hardware cycles to milliseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_cyc_to_ms_floor32

#define k_cyc_to_ms_floor32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to milliseconds.

32 bits. Truncates.

Converts time values in hardware cycles to milliseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_cyc_to_ms_floor64

#define k_cyc_to_ms_floor64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to milliseconds.

64 bits. Truncates.

Converts time values in hardware cycles to milliseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_cyc_to_ms_near32

#define k_cyc_to_ms_near32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to milliseconds.

32 bits. Round nearest.

Converts time values in hardware cycles to milliseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_cyc_to_ms_near64

#define k_cyc_to_ms_near64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ms, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to milliseconds.

64 bits. Round nearest.

Converts time values in hardware cycles to milliseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_cyc_to_ns_ceil32

#define k_cyc_to_ns_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to nanoseconds.

32 bits. Rounds up.

Converts time values in hardware cycles to nanoseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_cyc_to_ns_ceil64

#define k_cyc_to_ns_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to nanoseconds.

64 bits. Rounds up.

Converts time values in hardware cycles to nanoseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_cyc_to_ns_floor32

#define k_cyc_to_ns_floor32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to nanoseconds.

32 bits. Truncates.

Converts time values in hardware cycles to nanoseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_cyc_to_ns_floor64

#define k_cyc_to_ns_floor64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to nanoseconds.

64 bits. Truncates.

Converts time values in hardware cycles to nanoseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_cyc_to_ns_near32

#define k_cyc_to_ns_near32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to nanoseconds.

32 bits. Round nearest.

Converts time values in hardware cycles to nanoseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_cyc_to_ns_near64

#define k_cyc_to_ns_near64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ns, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to nanoseconds.

64 bits. Round nearest.

Converts time values in hardware cycles to nanoseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_cyc_to_ticks_ceil32

#define k_cyc_to_ticks_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to ticks.

32 bits. Rounds up.

Converts time values in hardware cycles to ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_cyc_to_ticks_ceil64

#define k_cyc_to_ticks_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to ticks.

64 bits. Rounds up.

Converts time values in hardware cycles to ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_cyc_to_ticks_floor32

#define k_cyc_to_ticks_floor32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to ticks.

32 bits. Truncates.

Converts time values in hardware cycles to ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_cyc_to_ticks_floor64

#define k_cyc_to_ticks_floor64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to ticks.

64 bits. Truncates.

Converts time values in hardware cycles to ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_cyc_to_ticks_near32

#define k_cyc_to_ticks_near32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to ticks.

32 bits. Round nearest.

Converts time values in hardware cycles to ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_cyc_to_ticks_near64

#define k_cyc_to_ticks_near64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to ticks.

64 bits. Round nearest.

Converts time values in hardware cycles to ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_cyc_to_us_ceil32

#define k_cyc_to_us_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to microseconds.

32 bits. Rounds up.

Converts time values in hardware cycles to microseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_cyc_to_us_ceil64

#define k_cyc_to_us_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to microseconds.

64 bits. Rounds up.

Converts time values in hardware cycles to microseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_cyc_to_us_floor32

#define k_cyc_to_us_floor32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to microseconds.

32 bits. Truncates.

Converts time values in hardware cycles to microseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_cyc_to_us_floor64

#define k_cyc_to_us_floor64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to microseconds.

64 bits. Truncates.

Converts time values in hardware cycles to microseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_cyc_to_us_near32

#define k_cyc_to_us_near32 (   t)     z_tmcvt_32(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to microseconds.

32 bits. Round nearest.

Converts time values in hardware cycles to microseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_cyc_to_us_near64

#define k_cyc_to_us_near64 (   t)     z_tmcvt_64(t, Z_HZ_cyc, Z_HZ_us, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert hardware cycles to microseconds.

64 bits. Round nearest.

Converts time values in hardware cycles to microseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in hardware cycles. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_ms_to_cyc_ceil32

#define k_ms_to_cyc_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert milliseconds to hardware cycles.

32 bits. Rounds up.

Converts time values in milliseconds to hardware cycles. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ms_to_cyc_ceil64

#define k_ms_to_cyc_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert milliseconds to hardware cycles.

64 bits. Rounds up.

Converts time values in milliseconds to hardware cycles. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ms_to_cyc_floor32

#define k_ms_to_cyc_floor32 (   t)     z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert milliseconds to hardware cycles.

32 bits. Truncates.

Converts time values in milliseconds to hardware cycles. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ms_to_cyc_floor64

#define k_ms_to_cyc_floor64 (   t)     z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert milliseconds to hardware cycles.

64 bits. Truncates.

Converts time values in milliseconds to hardware cycles. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ms_to_cyc_near32

#define k_ms_to_cyc_near32 (   t)     z_tmcvt_32(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert milliseconds to hardware cycles.

32 bits. Round nearest.

Converts time values in milliseconds to hardware cycles. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ms_to_cyc_near64

#define k_ms_to_cyc_near64 (   t)     z_tmcvt_64(t, Z_HZ_ms, Z_HZ_cyc, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert milliseconds to hardware cycles.

64 bits. Round nearest.

Converts time values in milliseconds to hardware cycles. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ms_to_ticks_ceil32

#define k_ms_to_ticks_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, true, false)

#include <zephyr/sys/time_units.h>

Convert milliseconds to ticks.

32 bits. Rounds up.

Converts time values in milliseconds to ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_ms_to_ticks_ceil64

#define k_ms_to_ticks_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, true, false)

#include <zephyr/sys/time_units.h>

Convert milliseconds to ticks.

64 bits. Rounds up.

Converts time values in milliseconds to ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_ms_to_ticks_floor32

#define k_ms_to_ticks_floor32 (   t)     z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, false, false)

#include <zephyr/sys/time_units.h>

Convert milliseconds to ticks.

32 bits. Truncates.

Converts time values in milliseconds to ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_ms_to_ticks_floor64

#define k_ms_to_ticks_floor64 (   t)     z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, false, false)

#include <zephyr/sys/time_units.h>

Convert milliseconds to ticks.

64 bits. Truncates.

Converts time values in milliseconds to ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_ms_to_ticks_near32

#define k_ms_to_ticks_near32 (   t)     z_tmcvt_32(t, Z_HZ_ms, Z_HZ_ticks, true, false, true)

#include <zephyr/sys/time_units.h>

Convert milliseconds to ticks.

32 bits. Round nearest.

Converts time values in milliseconds to ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_ms_to_ticks_near64

#define k_ms_to_ticks_near64 (   t)     z_tmcvt_64(t, Z_HZ_ms, Z_HZ_ticks, true, false, true)

#include <zephyr/sys/time_units.h>

Convert milliseconds to ticks.

64 bits. Round nearest.

Converts time values in milliseconds to ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in milliseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_ns_to_cyc_ceil32

#define k_ns_to_cyc_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to hardware cycles.

32 bits. Rounds up.

Converts time values in nanoseconds to hardware cycles. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ns_to_cyc_ceil64

#define k_ns_to_cyc_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to hardware cycles.

64 bits. Rounds up.

Converts time values in nanoseconds to hardware cycles. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ns_to_cyc_floor32

#define k_ns_to_cyc_floor32 (   t)     z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to hardware cycles.

32 bits. Truncates.

Converts time values in nanoseconds to hardware cycles. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ns_to_cyc_floor64

#define k_ns_to_cyc_floor64 (   t)     z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to hardware cycles.

64 bits. Truncates.

Converts time values in nanoseconds to hardware cycles. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ns_to_cyc_near32

#define k_ns_to_cyc_near32 (   t)     z_tmcvt_32(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to hardware cycles.

32 bits. Round nearest.

Converts time values in nanoseconds to hardware cycles. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ns_to_cyc_near64

#define k_ns_to_cyc_near64 (   t)     z_tmcvt_64(t, Z_HZ_ns, Z_HZ_cyc, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to hardware cycles.

64 bits. Round nearest.

Converts time values in nanoseconds to hardware cycles. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ns_to_ticks_ceil32

#define k_ns_to_ticks_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, true, false)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to ticks.

32 bits. Rounds up.

Converts time values in nanoseconds to ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_ns_to_ticks_ceil64

#define k_ns_to_ticks_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, true, false)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to ticks.

64 bits. Rounds up.

Converts time values in nanoseconds to ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_ns_to_ticks_floor32

#define k_ns_to_ticks_floor32 (   t)     z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, false, false)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to ticks.

32 bits. Truncates.

Converts time values in nanoseconds to ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_ns_to_ticks_floor64

#define k_ns_to_ticks_floor64 (   t)     z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, false, false)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to ticks.

64 bits. Truncates.

Converts time values in nanoseconds to ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_ns_to_ticks_near32

#define k_ns_to_ticks_near32 (   t)     z_tmcvt_32(t, Z_HZ_ns, Z_HZ_ticks, true, false, true)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to ticks.

32 bits. Round nearest.

Converts time values in nanoseconds to ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_ns_to_ticks_near64

#define k_ns_to_ticks_near64 (   t)     z_tmcvt_64(t, Z_HZ_ns, Z_HZ_ticks, true, false, true)

#include <zephyr/sys/time_units.h>

Convert nanoseconds to ticks.

64 bits. Round nearest.

Converts time values in nanoseconds to ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in nanoseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_ticks_to_cyc_ceil32

#define k_ticks_to_cyc_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert ticks to hardware cycles.

32 bits. Rounds up.

Converts time values in ticks to hardware cycles. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ticks_to_cyc_ceil64

#define k_ticks_to_cyc_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert ticks to hardware cycles.

64 bits. Rounds up.

Converts time values in ticks to hardware cycles. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ticks_to_cyc_floor32

#define k_ticks_to_cyc_floor32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert ticks to hardware cycles.

32 bits. Truncates.

Converts time values in ticks to hardware cycles. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ticks_to_cyc_floor64

#define k_ticks_to_cyc_floor64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert ticks to hardware cycles.

64 bits. Truncates.

Converts time values in ticks to hardware cycles. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ticks_to_cyc_near32

#define k_ticks_to_cyc_near32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert ticks to hardware cycles.

32 bits. Round nearest.

Converts time values in ticks to hardware cycles. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_ticks_to_cyc_near64

#define k_ticks_to_cyc_near64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_cyc, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert ticks to hardware cycles.

64 bits. Round nearest.

Converts time values in ticks to hardware cycles. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_ticks_to_ms_ceil32

#define k_ticks_to_ms_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, true, false)

#include <zephyr/sys/time_units.h>

Convert ticks to milliseconds.

32 bits. Rounds up.

Converts time values in ticks to milliseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_ticks_to_ms_ceil64

#define k_ticks_to_ms_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, true, false)

#include <zephyr/sys/time_units.h>

Convert ticks to milliseconds.

64 bits. Rounds up.

Converts time values in ticks to milliseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_ticks_to_ms_floor32

#define k_ticks_to_ms_floor32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, false, false)

#include <zephyr/sys/time_units.h>

Convert ticks to milliseconds.

32 bits. Truncates.

Converts time values in ticks to milliseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_ticks_to_ms_floor64

#define k_ticks_to_ms_floor64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, false, false)

#include <zephyr/sys/time_units.h>

Convert ticks to milliseconds.

64 bits. Truncates.

Converts time values in ticks to milliseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_ticks_to_ms_near32

#define k_ticks_to_ms_near32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ms, true, false, true)

#include <zephyr/sys/time_units.h>

Convert ticks to milliseconds.

32 bits. Round nearest.

Converts time values in ticks to milliseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in milliseconds. uint32_t

◆ k_ticks_to_ms_near64

#define k_ticks_to_ms_near64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ms, true, false, true)

#include <zephyr/sys/time_units.h>

Convert ticks to milliseconds.

64 bits. Round nearest.

Converts time values in ticks to milliseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in milliseconds. uint64_t

◆ k_ticks_to_ns_ceil32

#define k_ticks_to_ns_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, true, false)

#include <zephyr/sys/time_units.h>

Convert ticks to nanoseconds.

32 bits. Rounds up.

Converts time values in ticks to nanoseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_ticks_to_ns_ceil64

#define k_ticks_to_ns_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, true, false)

#include <zephyr/sys/time_units.h>

Convert ticks to nanoseconds.

64 bits. Rounds up.

Converts time values in ticks to nanoseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_ticks_to_ns_floor32

#define k_ticks_to_ns_floor32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, false, false)

#include <zephyr/sys/time_units.h>

Convert ticks to nanoseconds.

32 bits. Truncates.

Converts time values in ticks to nanoseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_ticks_to_ns_floor64

#define k_ticks_to_ns_floor64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, false, false)

#include <zephyr/sys/time_units.h>

Convert ticks to nanoseconds.

64 bits. Truncates.

Converts time values in ticks to nanoseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_ticks_to_ns_near32

#define k_ticks_to_ns_near32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_ns, true, false, true)

#include <zephyr/sys/time_units.h>

Convert ticks to nanoseconds.

32 bits. Round nearest.

Converts time values in ticks to nanoseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in nanoseconds. uint32_t

◆ k_ticks_to_ns_near64

#define k_ticks_to_ns_near64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_ns, true, false, true)

#include <zephyr/sys/time_units.h>

Convert ticks to nanoseconds.

64 bits. Round nearest.

Converts time values in ticks to nanoseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in nanoseconds. uint64_t

◆ k_ticks_to_us_ceil32

#define k_ticks_to_us_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, true, false)

#include <zephyr/sys/time_units.h>

Convert ticks to microseconds.

32 bits. Rounds up.

Converts time values in ticks to microseconds. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_ticks_to_us_ceil64

#define k_ticks_to_us_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, true, false)

#include <zephyr/sys/time_units.h>

Convert ticks to microseconds.

64 bits. Rounds up.

Converts time values in ticks to microseconds. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_ticks_to_us_floor32

#define k_ticks_to_us_floor32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, false, false)

#include <zephyr/sys/time_units.h>

Convert ticks to microseconds.

32 bits. Truncates.

Converts time values in ticks to microseconds. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_ticks_to_us_floor64

#define k_ticks_to_us_floor64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, false, false)

#include <zephyr/sys/time_units.h>

Convert ticks to microseconds.

64 bits. Truncates.

Converts time values in ticks to microseconds. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_ticks_to_us_near32

#define k_ticks_to_us_near32 (   t)     z_tmcvt_32(t, Z_HZ_ticks, Z_HZ_us, true, false, true)

#include <zephyr/sys/time_units.h>

Convert ticks to microseconds.

32 bits. Round nearest.

Converts time values in ticks to microseconds. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in microseconds. uint32_t

◆ k_ticks_to_us_near64

#define k_ticks_to_us_near64 (   t)     z_tmcvt_64(t, Z_HZ_ticks, Z_HZ_us, true, false, true)

#include <zephyr/sys/time_units.h>

Convert ticks to microseconds.

64 bits. Round nearest.

Converts time values in ticks to microseconds. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in ticks. uint64_t
Returns
The converted time value in microseconds. uint64_t

◆ k_us_to_cyc_ceil32

#define k_us_to_cyc_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert microseconds to hardware cycles.

32 bits. Rounds up.

Converts time values in microseconds to hardware cycles. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_us_to_cyc_ceil64

#define k_us_to_cyc_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, true, false)

#include <zephyr/sys/time_units.h>

Convert microseconds to hardware cycles.

64 bits. Rounds up.

Converts time values in microseconds to hardware cycles. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_us_to_cyc_floor32

#define k_us_to_cyc_floor32 (   t)     z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert microseconds to hardware cycles.

32 bits. Truncates.

Converts time values in microseconds to hardware cycles. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_us_to_cyc_floor64

#define k_us_to_cyc_floor64 (   t)     z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, false)

#include <zephyr/sys/time_units.h>

Convert microseconds to hardware cycles.

64 bits. Truncates.

Converts time values in microseconds to hardware cycles. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_us_to_cyc_near32

#define k_us_to_cyc_near32 (   t)     z_tmcvt_32(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert microseconds to hardware cycles.

32 bits. Round nearest.

Converts time values in microseconds to hardware cycles. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in hardware cycles. uint32_t

◆ k_us_to_cyc_near64

#define k_us_to_cyc_near64 (   t)     z_tmcvt_64(t, Z_HZ_us, Z_HZ_cyc, Z_CCYC, false, true)

#include <zephyr/sys/time_units.h>

Convert microseconds to hardware cycles.

64 bits. Round nearest.

Converts time values in microseconds to hardware cycles. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in hardware cycles. uint64_t

◆ k_us_to_ticks_ceil32

#define k_us_to_ticks_ceil32 (   t)     z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, true, false)

#include <zephyr/sys/time_units.h>

Convert microseconds to ticks.

32 bits. Rounds up.

Converts time values in microseconds to ticks. Computes result in 32 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_us_to_ticks_ceil64

#define k_us_to_ticks_ceil64 (   t)     z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, true, false)

#include <zephyr/sys/time_units.h>

Convert microseconds to ticks.

64 bits. Rounds up.

Converts time values in microseconds to ticks. Computes result in 64 bit precision. Rounds up to the next highest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_us_to_ticks_floor32

#define k_us_to_ticks_floor32 (   t)     z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, false, false)

#include <zephyr/sys/time_units.h>

Convert microseconds to ticks.

32 bits. Truncates.

Converts time values in microseconds to ticks. Computes result in 32 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_us_to_ticks_floor64

#define k_us_to_ticks_floor64 (   t)     z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, false, false)

#include <zephyr/sys/time_units.h>

Convert microseconds to ticks.

64 bits. Truncates.

Converts time values in microseconds to ticks. Computes result in 64 bit precision. Truncates to the next lowest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ k_us_to_ticks_near32

#define k_us_to_ticks_near32 (   t)     z_tmcvt_32(t, Z_HZ_us, Z_HZ_ticks, true, false, true)

#include <zephyr/sys/time_units.h>

Convert microseconds to ticks.

32 bits. Round nearest.

Converts time values in microseconds to ticks. Computes result in 32 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in ticks. uint32_t

◆ k_us_to_ticks_near64

#define k_us_to_ticks_near64 (   t)     z_tmcvt_64(t, Z_HZ_us, Z_HZ_ticks, true, false, true)

#include <zephyr/sys/time_units.h>

Convert microseconds to ticks.

64 bits. Round nearest.

Converts time values in microseconds to ticks. Computes result in 64 bit precision. Rounds to the nearest output unit.

Parameters
tSource time in microseconds. uint64_t
Returns
The converted time value in ticks. uint64_t

◆ sys_clock_hw_cycles_per_sec

#define sys_clock_hw_cycles_per_sec ( )    CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC

#include <zephyr/sys/time_units.h>

Get the system timer frequency.

Returns
system timer frequency in Hz

◆ SYS_FOREVER_MS

#define SYS_FOREVER_MS   (-1)

#include <zephyr/sys/time_units.h>

System-wide macro to denote "forever" in milliseconds.

Usage of this macro is limited to APIs that want to expose a timeout value that can optionally be unlimited, or "forever". This macro can not be fed into kernel functions or macros directly. Use SYS_TIMEOUT_MS instead.

◆ SYS_FOREVER_US

#define SYS_FOREVER_US   (-1)

#include <zephyr/sys/time_units.h>

System-wide macro to denote "forever" in microseconds.

See SYS_FOREVER_MS.

◆ SYS_TIMEOUT_MS

#define SYS_TIMEOUT_MS (   ms)

#include <zephyr/sys/time_units.h>

Value:
Z_TIMEOUT_TICKS((ms) == SYS_FOREVER_MS ? \
K_TICKS_FOREVER : Z_TIMEOUT_MS_TICKS(ms))
#define K_TICKS_FOREVER
Definition: sys_clock.h:51
#define SYS_FOREVER_MS
System-wide macro to denote "forever" in milliseconds.
Definition: time_units.h:33

System-wide macro to convert milliseconds to kernel timeouts.

◆ TIME_CONSTEXPR

#define TIME_CONSTEXPR