X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Focaml%2Flib%2Fkhatus_time.ml;fp=src%2Focaml%2Flib%2Fkhatus_time.ml;h=cf6538ac470f805e2c607a722c400ecfe62628d2;hb=c6a7396ebc93cec32a1465d878ac9d36465dcb19;hp=0000000000000000000000000000000000000000;hpb=ba303714d7c911d460040c0eff82e5f5f4b2c2d3;p=khatus.git diff --git a/src/ocaml/lib/khatus_time.ml b/src/ocaml/lib/khatus_time.ml new file mode 100644 index 0000000..cf6538a --- /dev/null +++ b/src/ocaml/lib/khatus_time.ml @@ -0,0 +1,24 @@ +module Span = struct + type t = float + + let of_string s = + float_of_string s + + let is_gt_or_eq t1 t2 = + t1 >= t2 +end + +type t = float + +let init = 0.0 + +let diff t0 t1 = + t1 -. t0 + +let to_string t = + Printf.sprintf "%f" t + |> String.split_on_char '.' + |> List.hd + +let of_string s = + float_of_string s