package time_now

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val nanoseconds_since_unix_epoch : Base.unit -> Base.Int63.t

Returns the number of nanoseconds that have passed since the unix epoch.

In Javascript, the resolution of the timestamp returned by this function is 1ms.

val nanosecond_counter_for_timing : Base.unit -> Base.Int63.t

nanosecond_counter_for_timing returns the number of nanos since an arbitrary epoch that is fixed at program startup. On some platforms the epoch is the unix epoch, and on other platforms the epoch is when the program starts running. The resulting timestamps are useful when compared to or subtracted from other timestamps produced by the same function in the same process. This is intended for use in benchmarks.

In Javascript, the resolution of the timestamp returned by this function is not formally defined, but in practice is significantly higher than the 1ms resolution produced by nanoseconds_since_unix_epoch.

OCaml

Innovation. Community. Security.