SRL Archive - General

Something wrong while using TimeMarker;


Zeta Matt

2013-04-27 22:38:34

It is returning the wrong time, see this:

program new;
{$i srl/srl.simba}

var
t: integer;

begin
SetupSRL;
MarkTime(t);
Wait(5000);
TimeFromMark(t);
WriteLn(IntToStr(t));
end.

This is the debug box:

Compiled successfully in 358 ms.
SRL Compiled in 0 msec
44229169
Successfully executed.

It had passed 5358ms and it showed 44229169ms. Is there something wrong with MarkTime or am I doing something stupid? IS there anything else I could use to mark the time from a certain point?

senrath

2013-04-27 22:44:30

You're using it wrong. You want this:
program new;
{$i srl/srl.simba}

var
t: integer;

begin
SetupSRL;
MarkTime(t);
Wait(5000);
WriteLn(IntToStr(TimeFromMark(t)));
end.

Zeta Matt

2013-04-27 22:48:23

Amazing! So I misunderstood what was written in the Timing SRL log, TimeFromMark doesn't set the time to a variable… it is the variable =O Thank you very much!

senrath

2013-04-27 22:57:17

Yeah, to make things clearer, all MarkTime is doing is setting t to GetSystemTime, while TimeFromMark is returning GetSystemTime - t. So either use TimeFromMark directly, or use it like t := TimeFromMark(t) to use later.

Zeta Matt

2013-04-27 23:15:36

Now, my scripts can close whenever I want, thank you very much