Erwin Craps
Erwin.Craps at ithelps.be
Fri Jun 27 01:04:23 CDT 2003
I don't know the status today on clocks in pc's but you must realize that clocks in pc's are pretty lousy. >From what I last recalled, pc clocks are only accurate to 1/3 of a second. And pc clocks do tend to run back or forward. You can minimize this by dooing a NET SET TIME in the logon scipt of a windows network, thus setting pc clocks just every logon. You can use a atomic clock program on the server with internet access. If you really need millisecond accuracy, you will need to buy you a hardware atomic clock (radio based) to put in your or all computers. Depends on how accurate it must be. Erwin -----Oorspronkelijk bericht----- Van: John Colby [mailto:jcolby at colbyconsulting.com] Verzonden: donderdag 26 juni 2003 1:05 Aan: accessd at databaseadvisors.com Onderwerp: RE: [AccessD] Time in milliseconds You pasted the code into a module instead of a class? Or you saved the class code to a name other than clsTimer. John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin - Beach Access Software Sent: Wednesday, June 25, 2003 6:45 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Time in milliseconds John: That looks real good. The time kind of got away from me so if I don't get a reply right away I can go with what I've got. But this would be better. I'm getting a compile error on Dim mclsTimer As clsTimer User defined type not defined. What have I left out? Best, Rocky ----- Original Message ----- From: John Colby <mailto:jcolby at colbyconsulting.com> To: accessd at databaseadvisors.com <mailto:accessd at databaseadvisors.com> Sent: Wednesday, June 25, 2003 10:13 AM Subject: RE: [AccessD] Time in milliseconds Rocky, Below is a modification to the TestTimer to time your form opening / closing 10 times. Obviously replace the form name(s) with your own. Option Compare Database Option Explicit Dim mclsTimer As clsTimer Function TestTimer() Dim intLoopCnt As Integer Set mclsTimer = New clsTimer For intLoopCnt = 1 To 10 DoCmd.OpenForm "frm_MoviesTab" DoCmd.Close acForm, "frm_MoviesTab" Next intLoopCnt MsgBox mclsTimer.EndTimer & " ms elapsed time - Hit any key to continue", , "TIMER TEST 1" mclsTimer.StartTimer For intLoopCnt = 1 To 10 DoCmd.OpenForm "frm_MoviesTab" DoCmd.Close acForm, "frm_MoviesTab" Next intLoopCnt MsgBox mclsTimer.EndTimer & " ms elapsed time - Hit any key to continue", , "TIMER TEST 1" Set mclsTimer = Nothing End Function John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin - Beach Access Software Sent: Wednesday, June 25, 2003 11:37 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Time in milliseconds John: Will it work across forms? I'm demonstrating your Just-In-Time forms at the AUGSD tonight and since it's a single user box the difference in opening time is hard to see, even though it's a factor of 2-4. I think I need to start my timing from the Main Menu Click event that opens the form with the sub-forms in it, as some of the processing of loading the sub-form's recordsets goes on even before the called form's OnOpen event. Best, Rocky ----- Original Message ----- From: John Colby <mailto:jcolby at colbyconsulting.com> To: accessd at databaseadvisors.com <mailto:accessd at databaseadvisors.com> Sent: Wednesday, June 25, 2003 6:47 AM Subject: RE: [AccessD] Time in milliseconds Rocky, Here is the class I use for timing things such as the opening of forms and such, with a timer test function you can place in a module to play around with the class. Dead simple to use. The nice thing about using a class is that you can have as many instances as you need timing various stuff since the variable tracking elapsed time is private to the class instance. Option Compare Database Option Explicit Dim mclsTimer As clsTimer Function TestTimer() Set mclsTimer = New clsTimer MsgBox "Hit any key to continue", , "TIMER TEST 1" MsgBox mclsTimer.EndTimer & " ms elapsed time - Hit any key to continue", , "TIMER TEST 1" MsgBox mclsTimer.EndTimer & " ms total elapsed time - Hit any key to continue", , "TIMER TEST 2" mclsTimer.StartTimer MsgBox "Hit any key to continue", , "TIMER TEST 3" MsgBox mclsTimer.EndTimer() & " ms elapsed time", , "TIMER TEST3" Set mclsTimer = Nothing End Function Option Compare Database Option Explicit '.=============================================================== '.Copyright 2001 Colby Consulting. All rights reserved. '.E-mail : jcolby at colbyconsulting.com <mailto:jcolby at colbyconsulting.com> '.=============================================================== ' DO NOT DELETE THE COMMENTS ABOVE. All other comments in this module ' may be deleted from production code, but lines above must remain. '--------------------------------------------------------------------- '.Description : Implements the instantiated class for: clsTimer '. '.Written By : John W. Colby '.Date Created : 05/28/2001 ' Rev. History : ' ' Comments : '--------------------------------------------------------------------- '. ' ADDITIONAL NOTES: ' '--------------------------------------------------------------------- ' ' INSTRUCTIONS: '--------------------------------------------------------------------- '. 'THESE CONSTANTS AND VARIABLES ARE USED INTERNALLY TO THE CLASS '*+ Class constant declaration '*- Class constants declaration '*+ Class variables declarations '*- Class variables declarations 'THESE CONSTANTS AND VARIABLES ARE USED BY THE CLASS TO 'IMPLEMENT CLASS FUNCTIONALITY Private Declare Function apiGetTime Lib "winmm.dll" _ Alias "timeGetTime" () As Long '*+ custom constants declaration '*- Custom constants declaration '*+ custom variables declarations Dim lngStartTime As Long '*- custom variables declarations 'THESE FUNCTIONS / SUBS ARE USED INTERNALLY TO THE CLASS '*+ Private Init/Terminate Interface Private Sub Class_Initialize() StartTimer End Sub '*- Public Init/Terminate interface '*- Parent/Child links interface 'THESE FUNCTIONS / SUBS ARE USED TO IMPLEMENT CLASS FUNCTIONALITY '*+Class function / sub declaration Function EndTimer() As Long EndTimer = apiGetTime() - lngStartTime End Function Sub StartTimer() lngStartTime = apiGetTime() End Sub Function RawTime() As Long RawTime = apiGetTime() End Function '*-Class function / sub declaration John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin - Beach Access Software Sent: Tuesday, June 24, 2003 12:08 AM To: AccessD at databaseadvisors.com Subject: [AccessD] Time in milliseconds Dear List: Is it possible to access/store/display the time in increments smaller than seconds. I need to time something in fractions of a second. MTIA Rocky _____ _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _____ _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030627/a775a3fa/attachment-0001.html>