[fpc-pascal] Sub-millisecond time measuring

Michael Van Canneyt michael at freepascal.org
Mon Jul 1 11:31:29 CEST 2024



On Mon, 1 Jul 2024, Sven Barth via fpc-pascal wrote:

> Adriaan van Os via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
> Sa., 29. Juni 2024, 21:21:
>
>> Michael Van Canneyt via fpc-pascal wrote:
>>>> Is that a function in the RTL? I can't find it.
>>>
>>> No, these are platform-specific functions.
>>>
>>> g_get_monotonic_time is probably just an alias for the linux/freebsd
>>> unit functions clock_gettime(CLOCK_MONOTONIC_RAW).
>>
>> g_get_monotonic_time is in glib <
>> https://docs.gtk.org/glib/func.get_monotonic_time.html>
>>
>>   function g_get_monotonic_time: gint64; cdecl; external;
>>
>> but it requires a bug fix when using gtk on MacOSX <
>> https://bugzilla.gnome.org/show_bug.cgi?id=728123>
>>
>
> I wouldn't introduce a dependency for something like GTK (especially GTK!)
> on macOS only to receive some timings. Simpler and more straight forward to
> just use the correct functions of the OS.

Exactly. 
That is why I gave the origins of these functions, instead of
high-level wrappers like g_get_monotonic_time or even epiktimer 
(a monstrosity in itself).

Michael.


More information about the fpc-pascal mailing list