[vlc-devel] [PATCH 02/15] vlc_common: add helper macros to convert to/from seconds/mtime_t explicitly
Rémi Denis-Courmont
remi at remlab.net
Sat Jun 16 09:08:29 CEST 2018
Le perjantaina 15. kesäkuuta 2018, 18.09.13 EEST Steve Lhomme a écrit :
> ---
> include/vlc_common.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/vlc_common.h b/include/vlc_common.h
> index cc2f39e84a5..3d17d8e6a63 100644
> --- a/include/vlc_common.h
> +++ b/include/vlc_common.h
> @@ -289,7 +289,10 @@
> typedef int64_t mtime_t;
>
> #define VTICK_FROM_MILLI(ms) ((ms) * (CLOCK_FREQ / 1000))
> -#define MILLI_FROM_VTICK(ms) (((ms) * 1000) / CLOCK_FREQ)
> +#define MILLI_FROM_VTICK(ms) ((ms) / (CLOCK_FREQ / 1000))
> +
> +#define SEC_FROM_VTICK(mt) ((mt) / CLOCK_FREQ) /* mtime_t in seconds
> */ +#define VTICK_FROM_SEC(sec) ((mtime_t)((sec) * CLOCK_FREQ)) /* seconds
> in mtime_t */
The cast prevents usage in constant context and serves no obvious purpose.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list