[vlc-devel] [PATCH 04/15] vlc_common: add helper function for explicit nanosecond to/from mtime_t conversion

Rémi Denis-Courmont remi at remlab.net
Fri Jun 15 19:58:39 CEST 2018


I'd use ms, us and ns. Nano is just weird.

Le 15 juin 2018 18:09:15 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>It will be handy if mtime_t has better precision than microseconds.
>---
> include/vlc_common.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
>diff --git a/include/vlc_common.h b/include/vlc_common.h
>index d4186883df6..3191d3ce4c8 100644
>--- a/include/vlc_common.h
>+++ b/include/vlc_common.h
>@@ -316,6 +316,15 @@ static inline int64_t milli_from_vtick(mtime_t mt)
>     return mt / (CLOCK_FREQ / 1000);
> }
> 
>+static inline mtime_t vtick_from_nano(int64_t nano)
>+{
>+    return nano / (INT64_C(1000000000) / CLOCK_FREQ);
>+}
>+static inline int64_t nano_from_vtick(mtime_t tck)
>+{
>+    return tck * INT64_C(1000000000) / CLOCK_FREQ;
>+}
>+
> /**
>  * The vlc_fourcc_t type.
>  *
>-- 
>2.17.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180615/5467cc38/attachment.html>


More information about the vlc-devel mailing list