I'm writing an app that hooks into a data stream from a race simulator. My app has various gauges that display this info to the user while they are in the event. I'm saving this data to a file as part of the display process.
What I'd like to do is then replay this through the gauges, but at real-time speed. My app replays the data from this stored file fine, but it's running as fast as the data can be read, which is too fast.
The data is stored in a byte array and written to disk, and read in a serial fashion, i.e. I don't read all the data at once. I had thought about writing a field with the time length of the data stream and then map that, somehow, when replaying, but it seemed overly complex to me.
I'm struggling to figure out how to match this to real-time. Now whilst I could put in a delay to simulate it to real-time the issue is that depending on how quickly the data is written, will impact what this "delay" value would be. Some systems will write at 60 records/sec others at 20 or 30 records/sec.
Within the data I capture is a time value, albeit a lap time, but I could put in an actual time field without much issue if needed.
So how do I match a recorded time stamp to replay in real-time on a replay.
The app is a C# WPF app. I've read a couple of posts about replay design, but they are all related to deterministic game development, which isn't what I'm doing.