From cb4bb9c9fd73ff9db5eb6b440e08a714adda5513 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Tue, 26 Nov 2024 01:12:52 -0600 Subject: [PATCH] timespec_utils.hpp --- src/timespec_utils.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/timespec_utils.hpp b/src/timespec_utils.hpp index 8a8f721a..96673afc 100644 --- a/src/timespec_utils.hpp +++ b/src/timespec_utils.hpp @@ -2,6 +2,23 @@ namespace TimeSpec { + static + inline + timespec + is_newer(const timespec &t0_, + const timespec &t1_) + { + if(t0_.tv_sec > t1_.tv_sec) + return t0_; + if(t0_.tv_sec == t1_.tv_sec) + { + if(t0_.tv_nsec > t1_.tv_nsec) + return t0_; + } + + return t1_; + } + static inline timespec