Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
|
Macros | |
#define | TIME_UTILS_BASE_YEAR 1900 |
Functions | |
int64_t | timeutil_timegm64 (const struct tm *tm) |
Convert broken-down time to a POSIX epoch offset in seconds. | |
time_t | timeutil_timegm (const struct tm *tm) |
Convert broken-down time to a POSIX epoch offset in seconds. | |
static void | timespec_from_timeout (k_timeout_t timeout, struct timespec *ts) |
Convert a kernel timeout to a timespec. | |
static k_timeout_t | timespec_to_timeout (const struct timespec *req, struct timespec *rem) |
Convert a timespec to a kernel timeout. |
#define TIME_UTILS_BASE_YEAR 1900 |
#include <zephyr/sys/timeutil.h>
|
inlinestatic |
#include <zephyr/sys/timeutil.h>
Convert a kernel timeout to a timespec.
This function converts time durations expressed as Zephyr k_timeout_t objects to struct timespec objects.
timeout
is not relative, (i.e. a timeout generated by K_TIMEOUT_ABS_TICKS or similar is used).timeout | the kernel timeout to convert | |
[out] | ts | the timespec to store the result |
|
inlinestatic |
#include <zephyr/sys/timeutil.h>
Convert a timespec to a kernel timeout.
This function converts a time duration, req
, expressed as a timespec object, to a Zephyr k_timeout_t object.
If req
contains a negative duration or if both tv_sec and tv_nsec fields are zero, this function will return K_NO_WAIT.
If req
contains the maximum representable timespec, {max(time_t), 999999999}, then this function will return K_FOREVER.
If req
contains a value that is greater than the maximum equivalent tick duration, then this function will return the maximum representable tick duration (i.e. req
will be rounded-down).
Otherwise, this function will return the k_timeout_t that is rounded-up to a tick boundary.
If rem
is not NULL, it will be set to the remainder of the conversion, i.e. the difference between the requested duration and the converted duration as a timespec object, approximately as shown below.
req | the requested timespec to convert | |
[out] | rem | optional pointer to a timespec to store the remainder |
#include <zephyr/sys/timeutil.h>
Convert broken-down time to a POSIX epoch offset in seconds.
tm | pointer to broken down time. |
(time_t)-1 is returned and errno
is set to ERANGE`
.#include <zephyr/sys/timeutil.h>
Convert broken-down time to a POSIX epoch offset in seconds.
tm | pointer to broken down time. |