I have found out that :erlang.convert_time_unit(1236133, :native, :millisecond) can throw :badarg but only on some platforms. This code works perfecly on my laptop (mac os x, elixir 1.3.4 installed via brew) but fails on dokku-based, ubuntu-based docker .
Any clue, why?
Seems that on Erlang 19 it works fine, has something significant changed from 18?
I have managed to reproduce it on my local box. I use just ubuntu 16.04 64-bit, erlang is in version 18.3-dfsg-1ubuntu3. Seems that no call to this function works properly.
I even tried in plain erl shell to see whether it is not an elixir issue:
5> erlang:convert_time_unit(1, second, native).
** exception error: bad argument
in function erlang:convert_time_unit/3
called as erlang:convert_time_unit(1,second,native)
It seems to work with erlang 19 but it introduces some issues with SSL so I do not want to migrate.