|
Zephyr Project API 4.2.0
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 *ts) |
| Convert a timespec to a kernel timeout. | |
| #define TIME_UTILS_BASE_YEAR 1900 |
#include <include/zephyr/sys/timeutil.h>
|
inlinestatic |
#include <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 | the kernel timeout to convert | |
| [out] | ts | the timespec to store the result |
|
inlinestatic |
#include <include/zephyr/sys/timeutil.h>
Convert a timespec to a kernel timeout.
This function converts durations expressed as a struct timespec to Zephyr k_timeout_t objects.
Given that the range of a struct timespec is much larger than the range of k_timeout_t, and also given that the functions are only intended to be used to convert time durations (which are always positive), the function will saturate to K_NO_WAIT if the tv_sec field of ts is negative.
Similarly, if the duration is too large to fit in k_timeout_t, the function will saturate to K_FOREVER.
| ts | the timespec to convert |
#include <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 <include/zephyr/sys/timeutil.h>
Convert broken-down time to a POSIX epoch offset in seconds.
| tm | pointer to broken down time. |