Re: Overriding GetTickCount??

Giganews Newsgroups
Subject: Re: Overriding GetTickCount??
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Fri, 14 Nov 2003

"Milan VXdgsvt" <milan_vxdgs…@seznam.cz> wrote in message
news:E41AC70F7386E240milan_vxdgs…@seznam.cz...

> So, one uses IdGlobal.GetTickCount, the other uses Windows.GetTickCount.
> However, the values are offset by some 12000!!

IdGlobal::GetTickCount() uses high-performance counters if they are
available, and only falls back to the standard GetTickCount() if the high
performance counters fail.

> So the testing code gets completely broken. I checked that in
> Indy10 the problem is the same (IdCoreGlobal.pas).

IdGlobal::GetTickCount() works the same way in both Indy 9 and 10.

> Why do you override an existing function to give different results??

It is not a matter of giving different results.  It is a matter to producing
an API that is cross-platform capable so that the rest of the library code
does not care which platform is is running on.  Indy works on Win32, Linux
(and soon .NET).  Linux, for example, does not have a GetTickCount()
function, so one is implemented manually, and then the rest of the library
code can call GetTickCount() whenever it needs to without having to check
everytime whether the platform is Win32 or Linux (or .NET) and perform the
necessary counter code explitically each time.  Creating such an overriding
function is meant for Indy's internal use, not for external application use.
If you mean to call the Win32 GetTickCount() function each time in your own
code, then do so.

Gambit

Replies

None

In response to

Overriding GetTickCount?? posted by Milan VXdgsvt on Fri, 14 Nov 2003