Time Between Value Changes in SQL

In PostgreSQL you could use window functions.
I just recently wrote some queries to calculate the rate of change of a variable which needed to know the length of time between data rows.