Algorithm Help

I want to add a feature to my LAPSTATS data field. Capture the Distance and Elapsed Time every 1/10th of a mile during a LAP. Then when the athlete hits lap again for their next lap, I can let them know how far ahead or behind they are relative to their last completed lap. (eg: -125m, +73m, etc).

However, I don't know in advance how long each lap is. It could be 1/4 mile, or 50 miles. For ultracyclists like me, 100 mile laps are not unreasonable to break down a 24 hour race into big chunks.

Here are two challenges:

1. I can't just compute the distance delta based based on average lap speed, because the lap could include steep hills or headwinds, and one section of the lap could be much slower/faster than another section. So I need to break it up into small sections. Like possibly every 1/10th of a mile. So to allow for a 100 mile lap, I'd need a 1000 element static array! Ugh. Lots of wasted memory for most laps that are much shorter. I have never used dynamic arrays. If these are a thing and not too expensive of an operation, I could simply extend the array every 1/10th of a mile when I capture the timestamp. Good idea?

2. For a short lap distance, like 1/4 mile... every 1/10th of a mile is too long. So I really need a dynamic segment size. But I don't know how long the lap will be. So I guess I could START out saving a timestamp every 50 meters, and if the lap extends beyond a mile, reduce the timestamp frequency to every 100 meters, and finally if the lap extends beyond 5 miles, reduce it to every 160 meters (about 1/10th of a mile). Or some dynamic adaptation like that. To provide good resolution and still not waste a ton of memory.

If you've done anything like this, let me know if you have ideas. THANKS!