[vlc-devel] [PATCH 06/15] vlc_common: add helper fonctions to convert from mtime_t to floating point seconds
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jun 15 17:09:17 CEST 2018
---
include/vlc_common.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 8b4baffcf27..fe1b125625f 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -333,6 +333,16 @@ static inline int64_t nano_from_vtick(mtime_t tck)
return tck * INT64_C(1000000000) / CLOCK_FREQ;
}
+static inline double secf_from_vtick(mtime_t m)
+{
+ return (double)m / (double)CLOCK_FREQ;
+}
+static inline mtime_t vtick_from_secf(double secf)
+{
+ return secf * CLOCK_FREQ; /* TODO use llround */
+}
+
+
/**
* The vlc_fourcc_t type.
*
--
2.17.0
More information about the vlc-devel
mailing list