]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/time/day_to_str.h: DAY_TO_STR(): Add macro
authorAlejandro Colomar <alx@kernel.org>
Mon, 29 Jan 2024 14:14:29 +0000 (15:14 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 14 Mar 2024 21:30:46 +0000 (16:30 -0500)
This macro ensures that the buffer is an array, and calculates the size.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/time/day_to_str.h

index 65601c96de5fc4ba3ab28566606b545422f65086..2689794ba9443f88d311130d9d01b66002cb19f2 100644 (file)
 
 #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);