[fpc-pascal] Efficient millisecond timestamp

Michael Van Canneyt michael at freepascal.org
Fri Jan 10 12:02:50 CET 2014



On Fri, 10 Jan 2014, Mark Morgan Lloyd wrote:

> Michael Van Canneyt wrote:
>
>>> And I hardly see the point of converting something coming from the 
>>> hardware and/or a kernel counter to a double and then back to a quadword.
>> 
>> Nevertheless, Now() is the only portable construct available. Multiply it 
>> with msecsperday and round to int64 if you need an integer value.
>
> What about non-portable, e.g. unix-only? I don't see anything obvious in the 
> BaseUnix documentation.

That's because there is nothing. 
Most platforms support get_clock() but in FPC this is linux-only, as far as I know.

> I'm sure there's something in EpikTimer I could use, but I'm trying to keep 
> things fairly lean.

Last time I looked, EpikTimer used Now() on Unixes, 
definitely if you were not on intel platforms. 
But maybe the situation has improved meanwhile, you would need to check the code.

Michael.



More information about the fpc-pascal mailing list