[vlc-devel] [PATCH 05/10] vlc_tick: add helper macros to conver to/from nanoseconds/vlc_tick_t

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


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

diff --git a/include/vlc_tick.h b/include/vlc_tick.h
index bf037087510..ae241099e00 100644
--- a/include/vlc_tick.h
+++ b/include/vlc_tick.h
@@ -51,6 +51,10 @@ typedef vlc_tick_t mtime_t; /* deprecated, use vlc_tick_t */
 #define VLC_TICK_FROM_SEC(sec)   ((sec) * CLOCK_FREQ)   /* seconds in vlc_tick_t */
 #define SEC_FROM_VLC_TICK(vtk)   ((vtk) / CLOCK_FREQ)   /* vlc_tick_t in seconds */
 
+#define VLC_TICK_FROM_NS(ns)    ((ns)  / (INT64_C(1000000000) / CLOCK_FREQ)) /* nanoseconds in vlc_tick_t */
+#define NS_FROM_VLC_TICK(vtk)   ((vtk) * (INT64_C(1000000000) / CLOCK_FREQ)) /* vlc_tick_t in nanoseconds */
+
+
 static inline vlc_tick_t vlc_tick_from_sec(int64_t sec)
 {
     return sec * CLOCK_FREQ;
-- 
2.17.0



More information about the vlc-devel mailing list