[fpc-pascal] Efficient millisecond timestamp
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Fri Jan 10 12:40:59 CET 2014
Michael Van Canneyt wrote:
> 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.
Thanks, I'll investigate.
>> 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.
OK, I'll look at that presently. My recollection is that it ran OK on
Linux SPARC etc. (although I didn't check /how/ it ran IYSWIM) but not
on Solaris SPARC.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list