Skip to content
This repository
tag: v1215
Fetching contributors…

Cannot retrieve contributors at this time

file 97 lines (74 sloc) 2.482 kb
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)

type t
(* FIXME, abstract away the type? *)
type tm = Unix.tm

val now : unit -> t
val infinity : t

val process_utime : unit -> t
val process_stime : unit -> t
val process_cutime : unit -> t
val process_cstime : unit -> t

val gmtime : t -> tm
val localtime : t -> tm

val gmt_msec : t -> int
val gmt_sec : t -> int
val gmt_min : t -> int
val gmt_hour : t -> int
val gmt_mday : t -> int
val gmt_mon : t -> int
val gmt_year : t -> int
val gmt_wday : t -> int
val gmt_yday : t -> int
val gmt_isdst : t -> bool

val local_msec : t -> int
val local_sec : t -> int
val local_min : t -> int
val local_hour : t -> int
val local_mday : t -> int
val local_mon : t -> int
val local_year : t -> int
val local_wday : t -> int
val local_yday : t -> int
val local_isdst : t -> bool

val mktime : year:int -> month:int -> day:int -> h:int -> min:int -> sec:int -> ms:int -> t

(*
let bound = Chrono.bound
*)

val zero : t

val is_infinite : t -> bool
val is_positive : t -> bool

val add : t -> t -> t
val difference : t -> t -> t
val max : t -> t -> t
val min : t -> t -> t

val is_after : t -> t -> bool
val is_before : t -> t -> bool

val seconds_float : float -> t
val seconds : int -> t
val minutes : int -> t
val hours : int -> t
val days : int -> t
val milliseconds : int -> t

val in_seconds : t -> float
val in_milliseconds : t -> int

val of_unix_time : float -> t
val of_unix_time_inf : float -> t (* Will not wrap past max_int *)
val to_unix_time : t -> float

val round_to_sec : t -> t


(** This function returns a time measured with better than millisecond precision.

PLEASE BE AWARE, that the official type of date/time at MLstate is the type
[t] above. You should only use this function when you absolutely need
sub-millisecond precision AND when you know what you are doing. *)
val get_accurate_time : unit -> float
Something went wrong with that request. Please try again.