Expanding on Stormwind's lead, I'd be curious whether your application needs a windowed average with equal weights per unit of time, or if an exponential moving average may suffice. The latter is very simple to implement, and can be adapted to a variable framerate like so:
float weight = 1 - pow(1 - responsiveness, dT * referenceFPS);
smoothedValue += (currentValue - smoothedValue) * weight;
Similar to a windowed average, this smooths-out fluctuations in an input signal, and gives the value a degree of "memory" or "inertia," while being much simpler to calculate. The differences is that it weighs the newest samples much more heavily than old samples, and has no absolute cutoff age like a windowed average.
Here's an example of how this compares against a 0.1s windowed average for a signal with a variable sampling rate. Here I'm using responsiveness = 0.5
and referenceFPS = 30

You can see the exponential moving average gives a fairly similar profile to the windowed average, especially when the value changes continuously. For sharp changes in the input value, you can see the exponential average has a somewhat sharper attack, and then closes in on a new sustained value asymptotically (where the moving average is guaranteed to reach a sustained input value by the end of the window duration).
In practice, we can usually tune the responsiveness
value to get the desired behaviour.
If your application really needs a windowed average, let us know and we can show you how to implement it efficiently with a ring buffer, albeit with more code complexity than the exponential example above.