[vlc-devel] [PATCH 04/16] common: add msftime_t to express 100ns time

Steve Lhomme robux4 at ycbcr.xyz
Thu Jun 7 11:59:48 CEST 2018


Such values currently have a better resolution than mtime_t
Also provide conversion macros to/from mtime_t
---
 include/vlc_common.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index ced2717e92..4c6192f33b 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -294,6 +294,13 @@ typedef int64_t mtime_t;
 #define MTIME_TO_SEC(mt)  ((mt) / CLOCK_FREQ)      /* mtime_t in seconds */
 #define SEC_TO_MTIME(sec) ((mtime_t)((sec) * CLOCK_FREQ)) /* seconds in mtime_t */
 
+/**
+ * Typically Microsoft time with 100ns resolutions
+  */
+typedef int64_t msftime_t;
+#define MTIME_TO_MSFTIME(mt)    ((msftime_t)((mt) * (INT64_C(10000000) / CLOCK_FREQ)))
+#define MSFTIME_TO_MTIME(msft)  ((mtime_t)((msft) / (INT64_C(10000000) / CLOCK_FREQ)))
+#define SEC_TO_MSFTIME(sec)     ((msftime_t)((sec) * INT64_C(10000000)))  /* seconds in msftime_t */
 
 /**
  * The vlc_fourcc_t type.
-- 
2.17.0



More information about the vlc-devel mailing list