[Oberon] FPGA - System Clock advance

Tomas Kral thomas.kral at email.cz
Thu Feb 28 20:25:54 CET 2019


Hi,

Getting ready for time ticks, while toying with this code.

  PROCEDURE Time*;
    VAR s, dt, hr, min, sec: INTEGER;
  BEGIN
    s := Kernel.Time() (*milis*) DIV 1000; (*seconds*) Texts.WriteInt(W, s, 6);
    hr := s DIV 3600; min := (*s - hr*3600*) s MOD 3600 DIV 60; sec :=  s MOD 60;
    Texts.WriteInt(W, hr, 6); Texts.WriteInt(W, min, 6); Texts.WriteInt(W, sec, 6);
    s := hr*3600 + min*60 + sec; Texts.WriteInt(W, s, 6); (*sanity check*)
    dt := hr*1000H + min*40H + sec; (*system date time*)
    (* Kernel.SetClock(dt); *) Texts.WriteClock(W, dt);
    Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
  END Time;

Now, in `Oberon.Mod' we have `GC' task getting awaken every 1000 ms = 1 sec. That could be used to advance system date time as well, using some of the code above.

The above code itself however consumes some time delta, not sure if need be compensated for?

Also, we could introduce a new message type for time updates, and broadcast by `Viewers.Broadcast()', so any code can poll the Kernel.Clock() by a given period?

-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list