Or you could use the GetLocalTime() API to optain a more specific time
information from Windows.
'Types....
'----------------------------
Type SYSTEMTIME
wYear As SmallInt
wMonth As SmallInt
wDayOfWeek As SmallInt
wDay As SmallInt
wHour As SmallInt
wMinute As SmallInt
wSecond As SmallInt
wMilliSeconds As SmallInt
End Type
'Declares....
'----------------------------
Declare Sub GetLocalTime Lib "kernel32" Alias "GetLocalTime" (lpSystemTime
As SYSTEMTIME)
Declare Sub Main
Sub Main
Dim ltNow as SYSTEMTIME
Call GetLocalTime(ltNow)
Note "It's now " & ltNow.wHour
& "." & ltNow.wMinute
& "." & ltNow.wSecond
& "." & ltNow.wMilliSeconds
& " o'clock"
End Sub
HTH,
Peter Horsb�ll M�ller
COWI A/S
-----Original Message-----
From: Jacques Paris
To: [EMAIL PROTECTED]; MIL
Sent: 03-04-03 15:35
Subject: RE: MI-L MB - system time accuracy
You will have to use some API calls to get it down to the maximum
allowable
precision that is in the order of the millisecond. One very simple
function
is GetTickCount() that has one drawback: as it uses only one integer
(instead of "long" structure of 2 integers for the other time functions)
it
does reset itself to zero every 49.2 days of Windows continuous use!!!
'GetTickCount() returns the time elapsed since Windows was last started
in
milliseconds
Declare Function GetTickCount Lib "kernel32.dll" () As Integer
'Example adapted from Paul Kuliniewicz's "Windows API Guide fro VB"
Dim starttime As Integer ' timer value before the calculation
Dim elapsetime as float ' duration of operation
Dim result as float ' for holding the result of the
"operation"
Dim I as integer ' counter for operation loop
' Find how much time has passed since Windows was started.
starttime = GetTickCount()
' Run the operation: Calculate the square root of a large number several
times.
for i = 1 to 10000
result = Sqr(54761345678876)
next
' The difference between the present "time" and endtime is the time it
took
' to calculate the square root.
elapsetime = (GetTickCount()- starttime)/10
Print "The calculation took " + str$(elapsetime) + " 1/10 of a
second."
An amusing sideline : On my machine that MBX took between 37.1 and 40.1
1/10
of a second on consecutive runs.
Jacques Paris
-----Original Message-----
From: Peter Zyczynski [mailto:[EMAIL PROTECTED]
Sent: April 2, 2003 23:02
To: [EMAIL PROTECTED]
Subject: MI-L MB - system time accuracy
Hi All,
Reading through the MB doco about obtaining system time using the
Time() function, it appears it's only accurate to the nearest second.
ie. it returns hours: minutes: seconds.
Does anyone know of a way to obtain the current system time down to a
tenth of a second? The application I'm writing deals with rally car
racing and needs to keep very accurate time.
I'm happy to write a DLL if that's what it takes, although I wonder if
this is a limitation of Windows.
Cheers,
Peter Zyczynski
Analyst Programmer
Insight GIS
Australia
Ph: (03) 6234-5833
Fax: (03) 6234-5899
[EMAIL PROTECTED]
www.insightgis.com.au
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 6191
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 6199
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 6213