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

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


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

diff --git a/include/vlc_tick.h b/include/vlc_tick.h
index 092ab93763b..0cd42824405 100644
--- a/include/vlc_tick.h
+++ b/include/vlc_tick.h
@@ -51,6 +51,9 @@ 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_US(us)    ((us)  * CLOCK_FREQ / INT64_C(1000000)) /* microseconds in vlc_tick_t */
+#define US_FROM_VLC_TICK(vtk)   ((vtk) * INT64_C(1000000) / CLOCK_FREQ) /* vlc_tick_t in microseconds */
+
 #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 */
 
-- 
2.17.0



More information about the vlc-devel mailing list