File: min_clock.ml

package info (click to toggle)
ocaml-mtime 2.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 200 kB
  • sloc: ml: 616; ansic: 166; javascript: 32; makefile: 15
file content (23 lines) | stat: -rw-r--r-- 672 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(*
   Compile with:

   ocamlfind ocamlopt \
     -package mtime.clock -linkpkg -o min_clock.native min_clock.ml

   ocamlfind ocamlc \
     -package mtime.clock -linkpkg -o min_clock.byte min_clock.ml

    js_of_ocaml \
      $(ocamlfind query -format "%+(jsoo_runtime)" -r mtime.clock) \
      min_clock.byte
*)

let main () =
  Format.printf "Elapsed: %a@." Mtime.Span.pp (Mtime_clock.elapsed ());
  Format.printf "Timestamp: %a@." Mtime.pp (Mtime_clock.now ());
  Format.printf "Clock period: %s@."
    (match Mtime_clock.period () with
    | None -> "unknown" | Some s -> Format.asprintf "%a" Mtime.Span.pp s);
  ()

let () = if !Sys.interactive then () else main ()