How to calculate time difference between two consecutive events

Hello,
Sensor sends packets in a 15-30 second interval which is stored in the mongodb collection.
For example
1-{18:56:23}
2-{18:56:56}
3-{18:57:23}
4-{18:57:45}
.
.
.

Now I have to do calculation for which I need to take out the difference between each such consecutive data packets time difference,
How can I find the difference between each consecutive packet time difference in an aggregation query?