summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-02-21 00:06:58 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-23 02:05:57 +0100
commit54d7ab4fa3b1cab1e5c9cd8732b26e476bd2bc0d (patch)
tree86f3b297390167a5058365653e403025590ac3b5
parent990f549999310abc2a47ebc6f7782d2e05ae8c96 (diff)
Add TIME_VALUE64_TO_TIMESPEC and TIMESPEC_TO_TIME_VALUE64
We can use these in userland with the new time_value64_t struct. Message-Id: <Y/RRck2JffqNenif@jupiter.tail36e24.ts.net>
-rw-r--r--include/mach/time_value.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/mach/time_value.h b/include/mach/time_value.h
index 2984e88c..0643b740 100644
--- a/include/mach/time_value.h
+++ b/include/mach/time_value.h
@@ -181,4 +181,16 @@ typedef struct mapped_time_value {
(tv)->microseconds = (ts)->tv_nsec / 1000; \
} while(0)
+/* Macros for converting between struct timespec and time_value64_t. */
+
+#define TIME_VALUE64_TO_TIMESPEC(tv, ts) do { \
+ (ts)->tv_sec = (tv)->seconds; \
+ (ts)->tv_nsec = (tv)->nanoseconds; \
+} while(0)
+
+#define TIMESPEC_TO_TIME_VALUE64(tv, ts) do { \
+ (tv)->seconds = (ts)->tv_sec; \
+ (tv)->nanoseconds = (ts)->tv_nsec; \
+} while(0)
+
#endif /* _MACH_TIME_VALUE_H_ */