[AccessD] Resolution of Time call

Stuart McLachlan stuart at lexacorp.com.pg
Tue Sep 27 08:59:27 CDT 2022


Resolution these days is a lot higher than 1/18 of a second.

Testing on my laptop, it's more like 8 milliseconds.
(If you need finer resolution, you can get 100 nanosecond resolution using API calls.)

Here's a demo of my resolution (7.8125 milliseconds)

Function TimeTest() As Long
Dim t As Double, t2 As Double
Dim x As Long, y As Long
Debug.Print "Seconds", "DIfference", "Iterations"
For y = 1 To 10
    t = Timer
    Do
        x = x + 1
        t2 = Timer
    Loop Until t <> t2
    Debug.Print t2, t2 - t, x
Next
End Function

timetest
Seconds       DIfference    Iterations
 85405.8515625               0.0078125     53373 
 85405.859375                0.0078125     74612 
 85405.8671875               0.0078125     104048 
 85405.875     0.0078125     131782 
 85405.8828125               0.0078125     149624 
 85405.890625                0.0078125     182648 
 85405.8984375               0.0078125     214853 
 85405.90625   0.0078125     245402 
 85405.9140625               0.0078125     275054 
 85405.921875                0.0078125     301396 


On 27 Sep 2022 at 12:20, Gustav Brock via AccessD wrote:

> Hi Arthur
> 
> Use Timer, much simpler. 
> It returns seconds since machine launch with about 1/18 s resolution
> and two decimals:
> 
> Dim StartTime As Currency
> Dim Duration As Currency
> 
> StartTime = Timer
> ' Run Process ...
> Duration = Timer - StartTime
> 
> Debug.Print Duration
> 
> /gustav
> 
> -----Oprindelig meddelelse-----
> Fra: AccessD <accessd-bounces+gustav=cactus.dk at databaseadvisors.com>
> På vegne af Arthur Fuller Sendt: 27. september 2022 14:09 Til: Access
> Developers discussion and problem solving
> <accessd at databaseadvisors.com> Emne: [AccessD] Resolution of Time call
> 
> I'm trying to time the duration of a test procedure. When I set a
> variable to Time, I get back something like "8:05:31 AM." First, what
> data type is this? Second, how can I grab just the seconds part?
> 
> --
> Arthur 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list