diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:32 +0000 |
commit | 8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch) | |
tree | 1fdda006866bca20d41cb206767ea5241e36852f /include/timeutils.h | |
parent | Adding debian version 2.39.3-11. (diff) | |
download | util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip |
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/timeutils.h')
-rw-r--r-- | include/timeutils.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/timeutils.h b/include/timeutils.h index a195df8..27261ab 100644 --- a/include/timeutils.h +++ b/include/timeutils.h @@ -18,6 +18,7 @@ #include <stdio.h> #include <inttypes.h> #include <sys/time.h> +#include <stdbool.h> typedef uint64_t usec_t; typedef uint64_t nsec_t; @@ -56,8 +57,10 @@ enum { ISO_TIMEZONE = (1 << 2), ISO_DOTUSEC = (1 << 3), ISO_COMMAUSEC = (1 << 4), - ISO_T = (1 << 5), - ISO_GMTIME = (1 << 6), + ISO_DOTNSEC = (1 << 5), + ISO_COMMANSEC = (1 << 6), + ISO_T = (1 << 7), + ISO_GMTIME = (1 << 8), ISO_TIMESTAMP = ISO_DATE | ISO_TIME | ISO_TIMEZONE, ISO_TIMESTAMP_T = ISO_TIMESTAMP | ISO_T, ISO_TIMESTAMP_DOT = ISO_TIMESTAMP | ISO_DOTUSEC, @@ -71,9 +74,11 @@ enum { #define CTIME_BUFSIZ 26 #define ISO_BUFSIZ 42 -int strtimeval_iso(struct timeval *tv, int flags, char *buf, size_t bufsz); -int strtm_iso(struct tm *tm, int flags, char *buf, size_t bufsz); +int strtimeval_iso(const struct timeval *tv, int flags, char *buf, size_t bufsz); +int strtm_iso(const struct tm *tm, int flags, char *buf, size_t bufsz); int strtime_iso(const time_t *t, int flags, char *buf, size_t bufsz); +int strtimespec_iso(const struct timespec *t, int flags, char *buf, size_t bufsz); +int strtimespec_relative(const struct timespec *ts, char *buf, size_t bufsz); #define UL_SHORTTIME_THISYEAR_HHMM (1 << 1) @@ -102,4 +107,9 @@ static inline struct timeval usec_to_timeval(usec_t t) return r; } +static inline bool is_timespecset(const struct timespec *t) +{ + return t->tv_sec || t->tv_nsec; +} + #endif /* UTIL_LINUX_TIME_UTIL_H */ |