🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1220

Re: GetTickCount

#1220
From: Ted Lyngmo
Date: Wed, 10 Oct 2007 04:56
49 lines
2601 bytes
Paul at NCF wrote:
 >
 > I've got a timer system that uses GetTickCount for calculate the
 > number ticks (in milliseconds), for timer calculations etc.
 >
 > This works fine on my laptop, which is quite a good HP running XP.
 > But on the target system running NT and is a lower spec PC, its not
 > accurate at all; usually timers are 10-20% longer (eg. A 15 second
 > timer ends up being about 18).

Are you doing something like this?

... {
    SetTimer( NULL, 0, 15000, TimerProc );
}

TimerProc(..., dwTime ) {
     static DWORD dwLastTime=0;
     SetTimer( NULL, 0, 15000, TimerProc );

     if( dwLastTime ) {
         /*
         dwTime - dwLastTime
         should now be approx. 15000, unless a wrap around occured,
         but you get 18000 ?
         */
     }
     dwLastTime = dwTime;
}

 > I've tried using the performance counter as a more accurate system,
 > but I'm not getting very good results even on my HP.
 >
 > Has anyone got any clues or ideas for a timer calculations for
 > handling timers of various lengths?

I used QueryPerformanceCounter() and QueryPerformanceFrequency() a few 
years back to measure RPM's in an engine (connected to a pin in the 
serial-port on a Windows NT4 box). We test-fed the application up to 
something like 300000 pulses/s (~0.003 ms between pulses) which it 
measured quite nicely.

> PS.  my perception of accuracy is based on the Now() time logged in a file 
> activitie (hours,mins,secs,milliseconds).

Hmmm, may we see some code?

Kind regards,
Ted Lyngmo
Technical Details
Message-ID: <470c5b61$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!eweka.nl!lightspeed.eweka.nl!195.114.231.69.MISMATCH!feeder.news-service.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4709d350@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,28d52fbe2eeb86d8
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 10 Oct 2007 06:56:05 +0200
From: Ted Lyngmo <tedREMOVETHIS@lyncon.se>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
X-Accept-Language: sv, en, en-us
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: GetTickCount
References: <4709d350@newsgroups.borland.com>
In-Reply-To: <4709d350@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 85.195.27.81
Message-ID: <470c5b61$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1191992161 85.195.27.81 (9 Oct 2007 21:56:01 -0700)
Lines: 49
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!eweka.nl!lightspeed.eweka.nl!195.114.231.69.MISMATCH!feeder.news-service.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail