[vlc-devel] [PATCH 03/16] common: add helper macros to convert to/from seconds/mtime_t explicitly

Steve Lhomme robux4 at ycbcr.xyz
Thu Jun 7 11:59:47 CEST 2018


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

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 1168f2dc1b..ced2717e92 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -291,6 +291,9 @@ typedef int64_t mtime_t;
 #define MS_TO_MTIME(ms) ((mtime_t)((ms) * (CLOCK_FREQ / 1000)))
 #define MTIME_TO_MS(ms) (((ms) * 1000) / CLOCK_FREQ)
 
+#define MTIME_TO_SEC(mt)  ((mt) / CLOCK_FREQ)      /* mtime_t in seconds */
+#define SEC_TO_MTIME(sec) ((mtime_t)((sec) * CLOCK_FREQ)) /* seconds in mtime_t */
+
 
 /**
  * The vlc_fourcc_t type.
-- 
2.17.0



More information about the vlc-devel mailing list