Calculating estimated time to peak of a repeating sawtooth pattern time series

I have data from an external process that is being scraped and pushed to influxdb every 30 seconds. It contains the time and positive number value that is constantly incrementing from zero to one at a fixed rate. Once the value crosses 1, it is reset back to 0 and the the process begins again but with a different fixed rate. The time series, as you can imagine, is a conventional sawtooth wave.

I am trying to create a panel of some sort that will show me the estimated time for the current cycle to complete.
To calculate this I need three values 1. Time the cycle started, 2. The current value, 3. The target value.
All three of these are present but i am unsure how to bring them together as an influx query. Any thoughts? Thanks.


might also be worth posting here