Using continuous query to find difference between hourly values

Hello, I have time-series data coming in at these timestamps

time

00:00:02
00:15:03
00:30:03
00:45:02
01:00:02

I want to run a continuous query that will calculate the delta for an hour. So it should calculate (value at 01:00:02) - (value at 00:00:02) and put it in another measurement table with timestamp as 01:00:00. This I want to be done for every hour. How can I achieve this using groupby() and offset_interval?
From what I read, the groupby interval for 1 hours will have a fixed non-overlapping boundary, say from 00:00:00 to 00:59:59. Whereas I want it to be something overlapping like:

00:00:00 to 01:05:00
01:00:00 to 02:05:00
02:00:00 to 03:05:00

and so on.

Thanks.

Hello @nikhilno1,
Welcome! Are you willing to upgrade to 2.x? I’m not sure how you can manipulate or subtract time with InfluxQL. You have a variety of options with Flux though:

Including experimental.subDuration() function | Flux 0.x Documentation

Thanks for your response.
I can upgrade if all the dependencies are in place (docker image, compatibility with grafana etc). Would I be losing out on anything?