How to Calculate total Runtime and StopTime from Timestamp in MSSQL

You use your DB's lead() or lag() functions with some subquery nesting. Examples lifted from a recent nearly identical question:

And more here.