fork download
  1. let sec_of_hms hms =
  2. let at i = int_of_string (String.sub hms i 2) in at 0 * 60 * 60 + at 3 * 60 + at 6
  3. let hms_of_sec sec =
  4. Printf.sprintf "%02d:%02d:%02d" (sec mod 86400 / 3600) (sec mod 3600 / 60) (sec mod 60)
  5. let (<<) f g x = f (g x)
  6. let f = hms_of_sec << (+) 1 << sec_of_hms
  7. let () = print_endline @@ f "00:00:00"
  8. let () = print_endline @@ f "23:59:59"
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
00:00:01
00:00:00