I found this formula defined in RFC 3550 for the RTP (Real Time Protocol). It's the same method used to calculate the Jitter in RTC:
let's say `Si` is the RTP timestamp from packet `i`, and `Ri` is the time of arrival in RTP timestamp units for packet `i`, then for two packets `i` and `j`, `D` may be expressed as
`D(i,j) = (Rj - Ri) - (Sj - Si) = (Rj - Sj) - (Ri - Si)`