package luv

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file time.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(* This file is part of Luv, released under the MIT license. See LICENSE.md for
   details, or visit https://github.com/aantron/luv/blob/master/LICENSE.md. *)



type t = {
  tv_sec : int64;
  tv_usec : int32;
}

let gettimeofday () =
  let timeval = Ctypes.make C.Types.Time.Timeval.t in
  C.Functions.Time.gettimeofday (Ctypes.addr timeval)
  |> Error.to_result_lazy begin fun () ->
    {
      tv_sec = Ctypes.getf timeval C.Types.Time.Timeval.sec;
      tv_usec = Ctypes.getf timeval C.Types.Time.Timeval.usec;
    }
  end

let hrtime =
  C.Functions.Time.hrtime

let sleep =
  C.Blocking.Time.sleep
OCaml

Innovation. Community. Security.