[fpc-pascal] timing again

spir ☣ denis.spir at gmail.com
Sun May 30 15:13:21 CEST 2010

On Tue, 18 May 2010 10:47:33 +0200 (CEST)
"Tomas Hajny" <XHajT03 at hajny.biz> wrote:

> On Mon, May 17, 2010 22:25, spir ☣ wrote:
> Hello Denis,
> > I posted a question about timing some time a go and got an answer; but let
> > down for a while because other problems required my attention. So, I need
> > a simple func to get the current time; mainly to benchmark various
> > implementation choices, possibly for other needs.
>  .
>  .
> If you need a high-resolution timer and only x86 platforms (or maybe
> x86_64 too), one option would be using the timer available in
> http://members.yline.com/~tom_at_work/cpudist.zip (see
> http://members.yline.com/~tom_at_work/ for link to documentation and
> further information).
> A completely platform independent solution included in FPC RTL but with
> lower precision is using either Dos.GetTime, Dos.GetMsCount or one of
> functions provided in unit SysUtils (e.g. GetLocalTime, Time or Now).

Thank you. Using dos.getTime (including its last arg), the following returns integer time in 10^-2s units:

Function TimeInt : Integer;
	h,m,s,f	: word;
	result := 360000*h + 6000*m + s*100 + f;

This is the needed base for my uses. (A unit of 1s is too gross for timing, this leads to endless runs; more precision than 10^-2s is unneeded.)


vit esse estrany ☣


More information about the fpc-pascal mailing list