(* simple-clock.ml Repeatedly prints the current time at the standard output, at intervals of 1 sec How to compile: ocamlopt -thread threads.cmxa unix.cmxa simple-clock.ml -o simple-clock *) open Unix open Thread 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 (); Thread.delay 1.0 done let _ = simple_clock ()