From 0b52aa9d137b03017313e028accc92dc5d536440 Mon Sep 17 00:00:00 2001 From: Erik Reider <35975961+ErikReider@users.noreply.github.com> Date: Sat, 30 Dec 2023 11:25:16 +0100 Subject: Initial rebase without effects --- include/util/env.h | 14 +++++++++++++- include/util/time.h | 8 +++++++- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'include/util') diff --git a/include/util/env.h b/include/util/env.h index 6720fa8..e271f4b 100644 --- a/include/util/env.h +++ b/include/util/env.h @@ -4,8 +4,20 @@ #include #include +/** + * Parse a bool from an environment variable. + * + * On success, the parsed value is returned. On error, false is returned. + */ bool env_parse_bool(const char *option); -ssize_t env_parse_switch(const char *option, const char **switches); +/** + * Pick a choice from an environment variable. + * + * On success, the choice index is returned. On error, zero is returned. + * + * switches is a NULL-terminated array. + */ +size_t env_parse_switch(const char *option, const char **switches); #endif diff --git a/include/util/time.h b/include/util/time.h index 287698d..3f76aa4 100644 --- a/include/util/time.h +++ b/include/util/time.h @@ -1,18 +1,24 @@ #ifndef UTIL_TIME_H #define UTIL_TIME_H +#include #include /** * Get the current time, in milliseconds. */ -uint32_t get_current_time_msec(void); +int64_t get_current_time_msec(void); /** * Convert a timespec to milliseconds. */ int64_t timespec_to_msec(const struct timespec *a); +/** + * Convert a timespec to nanoseconds. + */ +int64_t timespec_to_nsec(const struct timespec *a); + /** * Convert nanoseconds to a timespec. */ -- cgit v1.2.3