The online racing simulator
Split Time Conversion
(3 posts, started )
Split Time Conversion
I was just wondering if anyone had a small function to convert the LFS Split times to user readable times, I've taken Dygear/AndroidXP's idea and rewritten the function in VB.NET but its not perfect just wondering what other people have done for this?

TimeSpan.FromMilliseconds ?

http://www.lfsforum.net/showthread.php?p=722088


<?php 
  Dim returnTime 
As String String.Format("{0}:{1:f}"Math.Floor(IntTime 60000), (IntTime Mod 60000) / 1000)

 
'1:2.53 62530 = 1:02.53
?>


It doesn't add the leading 0 for seconds I guess I could add it in there manually but perhaps there's a simpler neater example?

<?php 
return string.Format("{0}:{1:00}.{2:00}"t.Minutest.SecondssecFraction);
?>

MSDN String.Format Method
Indeed, I think about it now and the PHP function date would be a good way to format the string. But it's kinda an odd way to go about it.

Example time of 1Hour.
01:00:00.00
1:00:00.00
60:00.00

I fell that the middle output is the most correct.

Example time of 56 Minutes, 2 Seconds and 24/1000ths of a second.
00:56:02.024
56:02.024
56:2.024

Again, I fell the middle output is the most correct.

Example time of 32 seconds and 512/1000ths of a second.
00:00:32.512
00:32.512
32.512

This time, I fell that the last example is the most correct way to output the value.

In pseudo code, I would want to make a function that would work like this.
if (Time greater then hour(1))
tStr = date('H:i:s', Time);
else if (Time greater then minute(1))
tStr = date('i:s', Time);
else
tStr = date('s', Time);
return concate(tStr, '.', miliseconds);


Split Time Conversion
(3 posts, started )
FGED GREDG RDFGDR GSFDG