My Assistant
![]() ![]() |
|
|
Jan 9 2007, 05:06 PM
Post
#1
|
|
|
UtterAccess Veteran Posts: 484 From: Florida |
Is there a way to format a time with milliseconds? I am working on a project for a friend with racing and he wants his lap times with milliseconds because many of the times are very close.. Seems silly but I can't seem to find it.. perhaps I am just supposed to construct it and decontruct if I want to perform any math on them?
CB |
|
|
|
Jan 9 2007, 05:42 PM
Post
#2
|
|
|
UtterAccess Editor Posts: 16,032 From: Northern Virginia, USA |
To get down to the milliseconds, I use an API call ...
CODE Public Declare Function GetTickCount Lib "kernel32" () As Long
When called in code, the fuction will return the number of Milleseconds the computer has been ON as a LONG INTEGER. So to get an elapsed time ... you would need the TickCount from when the race began and the TickCount of when the competitor finished. Note that in SOME circumstances you may need "Rollover" protection. |
|
|
|
Jan 9 2007, 06:02 PM
Post
#3
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
In addition to what Brent said, if you're speaking about a cell format, try custom format
hh:mm:ss,000 Martin |
|
|
|
Jan 9 2007, 07:53 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 3,752 From: Australia (NSW) |
Try the following code , which like Brent uses an API call, but also has subroutines for 'StartINg' and 'Stopping' with the 'STOP calculating the elapsed time in millisecs.
CODE Public Declare Function adh_apiGetTime Lib "winmm.dll" _
Alias "timeGetTime" () As Long Global lngStartTime As Long ' ' ' Sub adhStartTimer() ' Start the timer, storing the value in ' the module global, lngStartTime. lngStartTime = adh_apiGetTime() End Sub ' ' Function adhEndTimer() as Long ' End timing, and return the difference between the ' current time and lngStartTime adhEndTimer = adh_apiGetTime() - lngStartTime End Function |
|
|
|
Jan 9 2007, 08:03 PM
Post
#5
|
|
|
UtterAccess Veteran Posts: 484 From: Florida |
Sorry, wasn't referring to timing with my computer. I pull the data from the racetrack they provide us with actual times I just put them into excel.. I'm really just referring to the formatting.
Thanks everyone, CB |
|
|
|
Jan 10 2007, 01:37 AM
Post
#6
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
CB, Does the format I posted above work for you then?
|
|
|
|
Jan 10 2007, 02:52 AM
Post
#7
|
|
|
UtterAccess Ruler Posts: 1,183 From: Norfolk UK |
Hi CB,
Remember Martin uses European Regional settings, so you may need to change the format to hh:mm:ss.000 (sorry to jump in Martin) Stu. |
|
|
|
Jan 10 2007, 06:18 AM
Post
#8
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Hey, didn't I make a statement on how I like the variety of the WRS recently? link
Thanks Stu (IMG:http://www.utteraccess.com/forum/style_emoticons/default/sad.gif) Martin |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 20th June 2013 - 05:32 AM |