[vlc-devel] [PATCH 06/10] vlc_tick: add helper function to convert microseconds to/from vlc_tick_t

Steve Lhomme robux4 at ycbcr.xyz
Fri Jun 22 14:53:23 CEST 2018


---
 include/vlc_tick.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/vlc_tick.h b/include/vlc_tick.h
index ae241099e00..092ab93763b 100644
--- a/include/vlc_tick.h
+++ b/include/vlc_tick.h
@@ -77,6 +77,16 @@ static inline int64_t ms_from_vlc_tick(vlc_tick_t vtk)
     return vtk / (CLOCK_FREQ / 1000);
 }
 
+static inline vlc_tick_t vlc_tick_from_us(int64_t micro)
+{
+    return micro * CLOCK_FREQ / INT64_C(1000000);
+}
+
+static inline int64_t us_from_vlc_tick(vlc_tick_t vtk)
+{
+    return vtk * INT64_C(1000000) / CLOCK_FREQ;
+}
+
 static inline vlc_tick_t vlc_tick_from_ns(int64_t nano)
 {
     return nano / (INT64_C(1000000000) / CLOCK_FREQ);
-- 
2.17.0



More information about the vlc-devel mailing list