From 403a073c5527da26e472b6e230db6e7cf2dea8e8 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Thu, 17 Aug 2023 09:20:33 -0500 Subject: [PATCH] common: add a utime_t::max constant a convenient init value when searching for some early timepoint. Signed-off-by: Ronen Friedman --- src/include/utime.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/include/utime.h b/src/include/utime.h index ff8df7e5508f..588280a7df12 100644 --- a/src/include/utime.h +++ b/src/include/utime.h @@ -63,6 +63,10 @@ public: } } + static inline constexpr utime_t max() { + return utime_t{time_t{std::numeric_limits::max()}, 999'999'999ul}; + } + // cons constexpr utime_t() { tv.tv_sec = 0; tv.tv_nsec = 0; } constexpr utime_t(time_t s, int n) { tv.tv_sec = s; tv.tv_nsec = n; normalize(); } -- 2.47.3