Difference in time from one log to the next returned from a query

I’d like to be able to report and act on the time difference between logs returned by a DQL query. I use the DQL to filter down to the logs of interest, but then how do I compare the timestamp from log n+1 against log n?

I’ve looked though the documentation but not finding it. Timeseries doesn’t seem to help. What should I be looking at? I method like prev(timestamp) would be perfect.

If there is defined order of there log lines, this is doable this way: https://community.dynatrace.com/t5/DQL/Calculate-time-difference-between-two-records/m-p/257130/highlight/true#M1248

Unfortunately some additional limits apply regarding max number of records

works for me thanks! (even after modifying to fetch logs)