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

[Minios-devel] [UNIKRAFT PATCH v2 1/3] arch/time: Add macros for nanoseconds handling



Add macros for printing __nsec and __snsec types.
Add macro that retrieve the subseconds part of the
given nanoseconds.

Signed-off-by: Dafna Hirschfeld <dafna3@xxxxxxxxx>
---
 include/uk/arch/time.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uk/arch/time.h b/include/uk/arch/time.h
index d436a3b..262fd3b 100644
--- a/include/uk/arch/time.h
+++ b/include/uk/arch/time.h
@@ -50,6 +50,9 @@
 typedef __u64 __nsec;
 typedef __s64 __snsec;
 
+#define __PRInsec __PRIu64
+#define __PRIsnsec __PRIs64
+
 #define __NSEC_MAX (__U64_MAX)
 #define __SNSEC_MAX (__S64_MAX)
 #define __SNSEC_MIN (__S64_MIN)
@@ -57,6 +60,7 @@ typedef __s64 __snsec;
 #define ukarch_time_nsec_to_sec(ns)      ((ns) / 1000000000ULL)
 #define ukarch_time_nsec_to_msec(ns)     ((ns) / 1000000ULL)
 #define ukarch_time_nsec_to_usec(ns)     ((ns) / 1000UL)
+#define ukarch_time_subsec(ns)           ((ns) % 1000000000ULL)
 
 #define ukarch_time_sec_to_nsec(sec)     ((sec)  * 1000000000UL)
 #define ukarch_time_msec_to_nsec(msec)   ((msec) * 1000000UL)
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.