What time-weighted averages are and why you should care
<i>"a fully managed TimescaleDB service"</i><p>Weighted averaging as a commercial service, all by itself? The SQL solution seems complicated, but this is a task easily performed on time-ordered data.<p>I had to code such a time-weighted average last year, for a game client. The client gets updates for moving objects when they move a small distance or when some dwell time has elapsed. I needed a smoothed velocity from those irregularly spaced samples. The math had to be worked out, but it was just two lines of C++ in the implementation.[1]<p><pre><code>    filtermult = 1.0f - 1.0f / pow(1.0f + 1.0f / fsRegionCrossingSmoothingTime, secs); // filter scale factor
    mFiltered = val * filtermult + mFiltered * (1.0f - filtermult); // low pass filter
</code></pre>
[1] <a href="https://vcs.firestormviewer.org/phoenix-firestorm/files/tip/indra/newview/fsregioncross.cpp" rel="nofollow">https://vcs.firestormviewer.org/phoenix-firestorm/files/tip/...</a>