22 lines
634 B
OCaml
22 lines
634 B
OCaml
open Unix
|
|
|
|
let now () =
|
|
let current_time = time () in
|
|
let human_time = localtime current_time in
|
|
let year = 1900 + human_time.tm_year in
|
|
let month = human_time.tm_mon + 1 in
|
|
let day = human_time.tm_mday in
|
|
let hour = human_time.tm_hour in
|
|
let minute = human_time.tm_min in
|
|
let second = human_time.tm_sec in
|
|
|
|
Printf.sprintf "%04d-%02d-%02d %02d:%02d:%02d"
|
|
year month day hour minute second
|
|
|
|
let unhandled m = [%string "Runtime failure: unhandled %{Batteries.dump m}"] |> print_endline; exit 2
|
|
|
|
let one_second = 1_000_000L
|
|
|
|
let exit2 msg = let _ = print_endline msg in exit 2
|
|
|
|
module StringMap = Map.Make (String)
|