bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH gnumach] Add TIME_VALUE64_TO_TIMESPEC and TIMESPEC_TO_TIME_VALUE6


From: Flavio Cruz
Subject: [PATCH gnumach] Add TIME_VALUE64_TO_TIMESPEC and TIMESPEC_TO_TIME_VALUE64
Date: Tue, 21 Feb 2023 00:06:58 -0500

We can use these in userland with the new time_value64_t struct.
---
 include/mach/time_value.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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_ */
-- 
2.39.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]