Jackson Tale
Jackson Tale

Reputation: 25812

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

Unix.time() returns seconds.

How can I get the time in ms or ns?

Thanks

Upvotes: 4

Views: 3196

Answers (2)

Ashish Agarwal
Ashish Agarwal

Reputation: 3030

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

Upvotes: 4

Jeffrey Scofield
Jeffrey Scofield

Reputation: 66818

Try Unix.gettimeofday

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

Upvotes: 18

Related Questions