emm... WHY make it SOOO hard? it's just
Program MyProg;
var StartTime: Double;
Begin
StartTime := now;
//do something;
WriteLn(MilliSecondsBetween(Now, StartTime));
End.
Rewriting the original code:
Program MyProg;
var cooldown: double;
Begin
cooldown := now + 100/24/60/60/1000;
while true do begin
if Now > cooldown then begin
writeln(now); //something more user-friendly might be shown here, but I'm too lazy to check the syntax.
cooldown := now + 100/24/60/60/1000;
end;
end;
End.
P.S. Pay attention, your C code will never show anything as it will constantly shift cooldown by 100 ms every "while" round. I've moved cooldown initialization outside the while loop.
P.P.S. You might also want to note that now (and clock() too) have discretization of approx. 7 msec, if I remember it correctly. So you'll always get more than 100 ms interval between displayed times. Additional effort should be made to make the intervals as close to 100 ms as possible.