The online racing simulator
LFSLib - ElapsedTime
(7 posts, started )
#1 - eakew
LFSLib - ElapsedTime
Hi!,
I'm using LFSLib (congratulations ether!) in a insim tool, I Have a question, is there any problem in RaceTime Event and ElapsedTime (Time elapsed since start of race) property? Because Total time I see in LFS and ElapsedTime (TimeSpan), isn't the same.

Do you know other way of knowing, at any time, current race time?

Thank you!
Félix
Hola eak,

I've noticed there is a small delay when using the relay. How big is the difference in your case?
#3 - eakew
Quote from BurnOut69 :Hola eak,

I've noticed there is a small delay when using the relay. How big is the difference in your case?

The problem is not the difference, it seems that the value returned is not a TimeSpan value because, for example, the seconds are slower than in LFS ...
I believe that LFSLib converts it to milliseconds.

Quote from eakew :The problem is not the difference, it seems that the value returned is not a TimeSpan value because, for example, the seconds are slower than in LFS ...

#5 - eakew
I think the problem is in LFSLib RaceTime event


[FONT=Trebuchet MS]internal RaceTime(Packets.IS_SMALL packet)[/FONT]
[FONT=Trebuchet MS]{[/FONT]
[FONT=Trebuchet MS] this.packet = packet;[/FONT]
[FONT=Trebuchet MS] elapsed = new TimeSpan(0,0,0,0,(int)packet.UVal);[/FONT]
[FONT=Trebuchet MS]}[/FONT]

LFS InSim doc:

Quote :
// The time will be sent back in this IS_SMALL :
// ReqI : non-zero (as received in the request packet)
// SubT : SMALL_RTP (Race Time Packet)
// UVal : Time (hundredths of a second since start of race or replay)

TimeSpan constructor:


[FONT=Trebuchet MS]public TimeSpan ([/FONT]
[FONT=Trebuchet MS] int days,[/FONT]
[FONT=Trebuchet MS] int hours,[/FONT]
[FONT=Trebuchet MS] int minutes,[/FONT]
[FONT=Trebuchet MS] int seconds,[/FONT]
[FONT=Trebuchet MS] int [B][COLOR=red]milliseconds[/COLOR][/B][/FONT]
[FONT=Trebuchet MS])[/FONT]

then a possible and simple patch should go like this:

internal RaceTime(Packets.IS_SMALL packet)
{
this.packet = packet;
elapsed = new TimeSpan(0,0,0,0,(int)packet.UVal * 10);
}
#7 - eakew
Yes, it's what I did, and it works perfectly ... but seems that ElapsedTime begins when cars are placed on the grid, and not when race start (green light) ... but now, with the correct ElapsedTime data, can be calculated.
Thank you all.


P.D.: I'll report to LFSLib developer.

LFSLib - ElapsedTime
(7 posts, started )
FGED GREDG RDFGDR GSFDG