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

Steve Lhomme robux4 at ycbcr.xyz
Sat Jun 16 10:32:50 CEST 2018


On 2018-06-16 10:23 AM, Rémi Denis-Courmont wrote:
> Le lauantaina 16. kesäkuuta 2018, 10.34.18 EEST Steve Lhomme a écrit :
>> I used milli instead of ms so it's not confused with msftime_t. And so
>> micro and nano seems like logical siblings.
> Then keep mtime and screw this series.

I find mtime misleading. Especially because it assumes a certain value 
and in many parts of the code 1000 or 1000000 is used instead of proper 
conversion because what could possibly go wrong ? With a tick (or 
something else) you know you have to take care of a conversion in the 
proper time format you're handling.

mtime_t will stay for backward compatibility but IMO it should not be 
used anymore.

> As far as I am concerned, if you don't specify the time unit in a computer
> program, you are using local jiffies, not seconds. Talk about confusing.
>
> ISO C uses nsec, not nano. SI uses ms, µs and ns with us as the defacto
> standard transliteration of µs.

We could use nsec instead of nano to align with the standard. But then 
msec could be either milliseconds or microseconds. I'd rather have our 
naming consistent so it becomes intuitive to know which one you should 
use (having spent quite some on the 500 pending patches I'm starting to 
get it).


More information about the vlc-devel mailing list