How can I get the current system time in milliseconds or nanosec?

余生颓废 提交于 2021-02-05 06:17:25

问题


Unix.time() returns seconds.

How can I get the time in ms or ns?

Thanks


回答1:


Try Unix.gettimeofday

# Unix.time ();;
- : float = 1447865942.
# Unix.gettimeofday();;
- : float = 1447865947.56802297



回答2:


Core has very robust time related functions, and since 112.06.00 there is a Time_ns module.

utop # Time_ns.now();;
- : Time_ns.t = 2015-11-18 14:49:08.580109-05:00


来源:https://stackoverflow.com/questions/33785791/how-can-i-get-the-current-system-time-in-milliseconds-or-nanosec

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!