[vlc-devel] [PATCH 04/10] vlc_tick: add helper function for explicit nanosecond to/from vlc_tick_t conversion

Steve Lhomme robux4 at ycbcr.xyz
Fri Jun 22 14:53:21 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 66cf8ecf687..bf037087510 100644
--- a/include/vlc_tick.h
+++ b/include/vlc_tick.h
@@ -73,6 +73,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_ns(int64_t nano)
+{
+    return nano / (INT64_C(1000000000) / CLOCK_FREQ);
+}
+
+static inline int64_t ns_from_vlc_tick(vlc_tick_t vtk)
+{
+    return vtk * INT64_C(1000000000) / CLOCK_FREQ;
+}
+
 /*****************************************************************************
  * MSTRTIME_MAX_SIZE: maximum possible size of mstrtime
  *****************************************************************************
-- 
2.17.0



More information about the vlc-devel mailing list