[Lazarus] Epiktimer elapsed = negative value
Anthony Tekatch
anthony at unihedron.com
Mon Jul 7 13:21:16 CEST 2014
On Mon, 07 Jul 2014 11:28:06 +0200, Michael Schnell <mschnell at lumino.de> wrote:
> Moreover:
>
> Even if the CPU's hardware tick counter is used, in a multi-CPU system,
> each CPU might have it's own counter and those are not guaranteed to be
> in sync. as the OS might move the program from one CPU to the other,
> this method does not seem to be safe, either.
OK, thanks for the details.
From my initial measurements, the elapsed time jumped on its own from
465ms to -4294 seconds:
ET.Elapsed= 4.6544100000000000E-0001
ET.Elapsed=-4.2944917280000000E+0003
That is very close to 12 hours. My test showed that this could happen
within about 30 minutes of starting at any time of day.
I only really needed something to trigger once per second (on the second
would be nice), but it needs to be reliable and multiplatform. For now I
will just watch the datetime clock for changes as follows:
oldsec:=secondof(now);
while RunWhile do begin
while oldsec=secondof(now) do begin
sleep(10);
end;
oldsec:=secondof(now);
LogOneReading(); //Store successive readings (my code)
end;
Thanks,
Anthony
More information about the Lazarus
mailing list