diff options
author | Alejandro Colomar <alx@kernel.org> | 2024-01-29 15:14:29 +0100 |
---|---|---|
committer | Serge Hallyn <serge@hallyn.com> | 2024-03-14 16:30:46 -0500 |
commit | 19edb06fd2e4efe7f431b57ff9e7f05265e6fb16 (patch) | |
tree | 76f5a44c1782dd360ab8b3b4d08a0a102f5f6b8c | |
parent | be05c62bd7e146a54e6b54b1dc10c1e145e48381 (diff) |
lib/time/day_to_str.h: DAY_TO_STR(): Add macro
This macro ensures that the buffer is an array, and calculates the size.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | lib/time/day_to_str.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/time/day_to_str.h b/lib/time/day_to_str.h index 65601c96..2689794b 100644 --- a/lib/time/day_to_str.h +++ b/lib/time/day_to_str.h @@ -12,9 +12,14 @@ #include <time.h> +#include "defines.h" +#include "sizeof.h" #include "string/strtcpy.h" +#define DAY_TO_STR(str, day) date_to_str(NITEMS(str), str, day * DAY) + + inline void date_to_str(size_t size, char buf[size], long date); |