Sportswatch No timer

flebber

Registered User.
Local time
Tomorrow, 10:22
Joined
Mar 13, 2010
Messages
19
I am investigating how to format my time entries to match that of a sports stopwatch. I need it to be accurate to hundredths of a second, however I don't need a timer function as data will be either imported or manually input.

I found this on google Stopwatch Tek tips. It basically advises use of a text input mask.
Access date/time datatype only stores hour:minute:second because it stores a date as an 8-byte floating point number.

The best option is to store it as text - setting the input mask to: 00:00:00
I need to clarify though as my time will never contain hours only minutes, seconds, hundredths mm:ss:00 , format would be fine. I need to be able to calculate the time correctly for example on lap 1 car b took 01:22:55 and was 1 second and 37 hundredths off the course record etc. I need to ensure that validation can work in a text input mask as seconds can never be greater than 60 and hundredths never greater than 100. Technically though it never would happen minutes could exceed 60 as I am not recording hours.
 
I think you ned to record the times as if they were multiplied up to the next level. 10:36:30 would not be 10hrs 36mins 30secs it would be 10mins 36secs 30 millisecs

Your only problem would be if your timings actually went over 1 hours.
Then again how many dec places are you going to in your milli seconds?
 
I think you ned to record the times as if they were multiplied up to the next level. 10:36:30 would not be 10hrs 36mins 30secs it would be 10mins 36secs 30 millisecs

Your only problem would be if your timings actually went over 1 hours.
Then again how many dec places are you going to in your milli seconds?

My times will never break an hour, and I will be measuring down to hundredths of seconds.
 
I think you ned to record the times as if they were multiplied up to the next level. 10:36:30 would not be 10hrs 36mins 30secs it would be 10mins 36secs 30 millisecs
10:39:99 ??

99 miliseconds is valid but not displayable in a time format ...

HH:MM:SS.mmm

where mmm is the milliseconds... i.e. The SQL server notation and yes that is not possible in access.

If you only have seconds/millseconds you can use a normal number... which will work fine if up to 59 secs.... 12.345 or 59.876 :D

If you need the minute, 1:23.456 you need the text or display 83.456, or use two number fields, one for minute and one for the seconds part, 1 and 23.456

The advantage of keeping it 'real' numbers is the sorting and summing/averaging stays possible
 
Just thinking out loud, but maybe each part (Minutes, Seconds, Fraction) could be stored in a seperate field?

Or maybe each time could be stored as a whole number? i.e. 5:23:79 = 32379 hundredths, then calculate backwards where necessary?
 
okay so if I store it as a real number I am going to need the user to input the time which commonly occurs as 02:30:45 for example. So then I would need three separate fields for input and a calculation to convert it to real numbers.

so mm*60 + seconds +0.xx which is good because then I can validate data.

though I understand to convert it back I divide the real number by 60 for minutes can anyone advise how to or know a good link on how to format it out for the end users to see in reports
 
I am still trying to implement a good solution. I have been given the below from Arvin Meyer MVP. I haven't yet been able to test it but thought it may benefit others who could require it.

Time is not duration, and that's really what you need to store. Have you
thought of storing milliseconds then formatting them into the time display
that you are looking for? Here's some code that may help you:
VBA time does not resolve to the millisecond. You have to use Win32API.
Sample code follows:

' Declarations section
' System time - coorindated universal time (UTC)

Private Type SYSTEMTIME
intYear As Integer
intMonth As Integer
intDayOfWeek As Integer
intDay As Integer
intHour As Integer
intMinute As Integer
intSecond As Integer
intMilliseconds As Integer
End Type

Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
'---------------------------------------------------------------------------
' Systemtime

Public Function GetTimeUTC() As String
'Returns a string containing UTC time to the millisecond
'that is unique and not internationalized
' SystemTime structure is loaded in declarations section

' Procedure dimensions
Dim lngType As Long
Dim stSystemTime As SYSTEMTIME
Call GetSystemTime(stSystemTime)

With stSystemTime
GetTimeUTC = Format(.intHour, "00") + ":" + Format(.intMinute, "00") _
+ ":" + Format(.intSecond, "00") + ":" + Format(.intMilliseconds, "000")
End With

End Function
 

Users who are viewing this thread

Back
Top Bottom