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 result_unpack = function | Ok o -> o | Error e -> e let unhandled m = [%string "Runtime failure: unhandled %{Batteries.dump m}"] |> print_endline; exit 2 let one_second = 1_000_000L