(* simple-clock.ml Repeatedly prints the current time at the standard output, at intervals of 1 sec How to compile: ocamlopt unix.cmxa simple-clock.ml -o simple-clock *) open Unix let print_tm tm = print_int tm.tm_hour; print_char ':'; print_int tm.tm_min; print_char ':'; print_int tm.tm_sec let simple_clock () = while true do print_tm (Unix.localtime (Unix.time ())); print_newline (); ignore (Unix.select [] [] [] 1.0) done let _ = simple_clock ()