This example program displays a digital clock on the text console
$ include "seed7_05.s7i";
include "time.s7i";
include "duration.s7i";
include "keybd.s7i";
const proc: main is func
local
var time: next_time is time.value;
begin
writeln;
next_time := truncToSecond(time(NOW));
while not inputReady(KEYBOARD) do
next_time +:= 1 . SECONDS;
await(next_time);
write(next_time <& " \r");
flush(OUT);
end while;
writeln;
writeln;
end func;
This example uses time functions like time(NOW), truncToSecond and await(next_time).
There is an addition of a duration to a time with +:= and a time is written with 'write(next_time)'.
The program is terminated if a key is pressed. This check is done with the inputReady(KEYBOARD) function.