Bobby Heid
bheid at appdevgrp.com
Tue May 9 10:08:42 CDT 2006
Lambert, The whole idea was to be able to time sections of code (or any elapsed event). So having an active timer is just a waste of resources in that it causes an event to be fired at x intervals. Sorry if I misinterpreted your email. Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Tuesday, May 09, 2006 10:43 AM To: 'Access Developers discussion and problem solving' Subject: [SPAM SUSPECT] Re: [AccessD] Timer class suggestions... Importance: Low Hello Gustav, As the kBase article says that GetTickCount and TimeGetTime have ~10ms resolution I wonder if there is anything to be gained in using them rather that the built-in function Timer, which also has ~10ms resolution? Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, May 09, 2006 10:24 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Timer class suggestions... Hi Bobby Never heard of those QueryPerformance-things so I located this page: http://support.microsoft.com/kb/q172338 However, the info here is wrong. timeGetTime is certainly accurate to the millisecond, thus the most precise of all standard timer functions. But you must specify to use a resolution of 1 ms. 1. Insert this declaration: Private Declare Function timeBeginPeriod Lib "winmm.dll" ( _ ByVal uPeriod As Long) _ As Long 2. Modify the code like this: ' ' Time GetTickCount ' ' Set resolution of timer to 1 ms. timeBeginPeriod 1 Debug.Print Loops = 0 Count1 = GetTickCount() 3. Run code: Start Value: 9221238,3029 End Value: 9221238,3039 QueryPerformanceCounter minimum resolution: 1/3579545 sec API Overhead: 2,79365114840015E-06 seconds GetTickCount minimum resolution: 15 ms Took 23289 loops timeGetTime minimum resolution: 1 ms Took 187 loops As for your class I've never had extensive timer needs so I have no comments. /gustav