[vlc-devel] [PATCH 05/15] vlc_common: add helper function to convert microseconds to/from mtime_t

Steve Lhomme robux4 at ycbcr.xyz
Fri Jun 15 17:09:16 CEST 2018


---
 include/vlc_common.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 3191d3ce4c8..8b4baffcf27 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -316,6 +316,14 @@ static inline int64_t milli_from_vtick(mtime_t mt)
     return mt / (CLOCK_FREQ / 1000);
 }
 
+static inline int64_t micro_from_vtick(mtime_t mt)
+{
+    return mt * INT64_C(1000000) / CLOCK_FREQ;
+}
+static inline mtime_t vtick_from_micro(int64_t micro)
+{
+    return micro * CLOCK_FREQ / INT64_C(1000000);
+}
 static inline mtime_t vtick_from_nano(int64_t nano)
 {
     return nano / (INT64_C(1000000000) / CLOCK_FREQ);
-- 
2.17.0



More information about the vlc-devel mailing list