+#define COMPARE_TS(ts) COMPARE_TS_REAL(fdata1->ts, fdata2->ts)
+
+void
+frame_delta_abs_time(const frame_data *fdata, const frame_data *prev, nstime_t *delta)
+{
+ if (prev) {
+ nstime_delta(delta, &fdata->abs_ts, &prev->abs_ts);
+ } else {
+ /* If we don't have the time stamp of the previous packet,
+ it's because we have no displayed/captured packets prior to this.
+ Set the delta time to zero. */
+ nstime_set_zero(delta);
+ }
+}
+
+static gint
+frame_data_time_delta_compare(const frame_data *fdata1, const frame_data *fdata2)
+{
+ nstime_t del_cap_ts1, del_cap_ts2;
+
+ frame_delta_abs_time(fdata1, fdata1->prev_cap, &del_cap_ts1);
+ frame_delta_abs_time(fdata2, fdata2->prev_cap, &del_cap_ts2);
+
+ return COMPARE_TS_REAL(del_cap_ts1, del_cap_ts2);
+}
+
+static gint
+frame_data_time_delta_dis_compare(const frame_data *fdata1, const frame_data *fdata2)
+{
+ nstime_t del_dis_ts1, del_dis_ts2;
+
+ frame_delta_abs_time(fdata1, fdata1->prev_dis, &del_dis_ts1);
+ frame_delta_abs_time(fdata2, fdata2->prev_dis, &del_dis_ts2);
+
+ return COMPARE_TS_REAL(del_dis_ts1, del_dis_ts2);
+}
+