使用时monontonic_time/1,我的shell只接受单位seconds而不是second(根据文档):
2> erlang:monotonic_time(seconds).
9
5> erlang:monotonic_time(second).
** exception error: bad argument
in function erlang:monotonic_time/1
called as erlang:monotonic_time(second)
Run Code Online (Sandbox Code Playgroud)
其他人有这个奇怪的问题吗?我正在运行Erlang 19.
你可能在Erlang 19.0上.在此提交中添加了单数+非下划线版本,根据Github,包含此提交的第一个标记是OTP-19.1或Erlang/OTP版本19.1.我可以在Erlang 19.1中确认这两个second并seconds为我工作:
$ erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell
19.1
Run Code Online (Sandbox Code Playgroud)
$ erl
1> erlang:monotonic_time(second).
-576460744
2> erlang:monotonic_time(seconds).
-576460743
Run Code Online (Sandbox Code Playgroud)