X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Ftime-util.h;h=fca8a4db9b85324c1d9329daef58f0b15d12b9a0;hb=01c94c5d0aff09b4c0e429d483c8eeba40017071;hp=05369d295b3139db812f2b239be95047e6c1ae6d;hpb=5ab99e076c72a44f2e174e48abd9945cd0180d76;p=elogind.git diff --git a/src/shared/time-util.h b/src/shared/time-util.h index 05369d295..fca8a4db9 100644 --- a/src/shared/time-util.h +++ b/src/shared/time-util.h @@ -65,7 +65,9 @@ typedef struct dual_timestamp { #define FORMAT_TIMESTAMP_RELATIVE_MAX 256 #define FORMAT_TIMESPAN_MAX 64 -#define DUAL_TIMESTAMP_NULL ((struct dual_timestamp) { 0, 0 }) +#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) + +#define DUAL_TIMESTAMP_NULL ((struct dual_timestamp) { 0ULL, 0ULL }) usec_t now(clockid_t clock); @@ -105,3 +107,5 @@ int get_timezones(char ***l); bool timezone_is_valid(const char *name); clockid_t clock_boottime_or_monotonic(void); + +#define xstrftime(buf, fmt, tm) assert_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0)