[Lazarus] How to program with time in milliseconds?

Michael Schnell mschnell at lumino.de
Thu May 15 11:08:32 CEST 2014


On 05/15/2014 09:51 AM, Michael Van Canneyt wrote:
>
>
>>
>> Of course in the end I need something that works for any CPU and OS.
>
> There is nothing. EpikTimer pretends to fill this gap, but it does not.
Yep.

If necessary I could try to do something myself (i.e. an improved 
version of fpgettimeofday), with alternative {$if -ed implementations 
for different settings of the arch and OS settings. But thoroughly 
testing this seems like a nightmare.

>
> Don't get me wrong: I have nothing against the epiktimer, but it is 
> presented as some super cross-platform solution (or so I perceive it).
>
> Which is simply not correct. Unless you use the i386 version of the 
> compiler, it is not better than using now().
In fact in Linux it does call fpgettimeofday() (or did I install an old 
version ? )
>
>>
>> At best, fpgettimeofday itself should be improved (maybe using 
>> "Performance counter" register if the Arch allows for or vDSO if the 
>> OS allows for).
>
> FYI: fpgettimeofday is a direct kernel call, there is nothing to improve.
>
I do know (I did ASM stepping), but it does not need to stay that way. 
(Or maybe there is a platform independent function in the RTL that is 
used to delegate to fpgettimeofday)

If the arch and OS allows for it could work differently (e.g. use vDSO 
or use a performance counter register, adding value calculated an 
initializing action.

-Michael




More information about the Lazarus mailing list