aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/column-utils.c37
-rw-r--r--epan/dissectors/packet-frame.c24
-rw-r--r--epan/frame_data.c95
-rw-r--r--epan/frame_data.h14
-rw-r--r--epan/wslua/wslua_pinfo.c13
-rw-r--r--file.c28
-rw-r--r--plugins/ethercat/packet-esl.c2
-rw-r--r--rawshark.c19
-rw-r--r--tshark.c28
-rw-r--r--ui/gtk/time_shift_dlg.c22
10 files changed, 165 insertions, 117 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index a26950c4df..7737ec99dc 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -944,16 +944,20 @@ col_set_rel_time(const frame_data *fd, column_info *cinfo, const int col)
static void
col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col)
{
+ nstime_t del_cap_ts;
+
+ frame_delta_abs_time(fd, fd->prev_cap, &del_cap_ts);
+
switch (timestamp_get_seconds_type()) {
case TS_SECONDS_DEFAULT:
- set_time_seconds(&fd->del_cap_ts, cinfo->col_buf[col]);
+ set_time_seconds(&del_cap_ts, cinfo->col_buf[col]);
cinfo->col_expr.col_expr[col] = "frame.time_delta";
g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
break;
case TS_SECONDS_HOUR_MIN_SEC:
- set_time_hour_min_sec(&fd->del_cap_ts, cinfo->col_buf[col]);
+ set_time_hour_min_sec(&del_cap_ts, cinfo->col_buf[col]);
cinfo->col_expr.col_expr[col] = "frame.time_delta";
- set_time_seconds(&fd->del_cap_ts, cinfo->col_expr.col_expr_val[col]);
+ set_time_seconds(&del_cap_ts, cinfo->col_expr.col_expr_val[col]);
break;
default:
g_assert_not_reached();
@@ -965,20 +969,25 @@ col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col)
static void
col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col)
{
+ nstime_t del_dis_ts;
+
if (!fd->flags.has_ts) {
cinfo->col_buf[col][0] = '\0';
return;
}
+
+ frame_delta_abs_time(fd, fd->prev_dis, &del_dis_ts);
+
switch (timestamp_get_seconds_type()) {
case TS_SECONDS_DEFAULT:
- set_time_seconds(&fd->del_dis_ts, cinfo->col_buf[col]);
+ set_time_seconds(&del_dis_ts, cinfo->col_buf[col]);
cinfo->col_expr.col_expr[col] = "frame.time_delta_displayed";
g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
break;
case TS_SECONDS_HOUR_MIN_SEC:
- set_time_hour_min_sec(&fd->del_dis_ts, cinfo->col_buf[col]);
+ set_time_hour_min_sec(&del_dis_ts, cinfo->col_buf[col]);
cinfo->col_expr.col_expr[col] = "frame.time_delta_displayed";
- set_time_seconds(&fd->del_dis_ts, cinfo->col_expr.col_expr_val[col]);
+ set_time_seconds(&del_dis_ts, cinfo->col_expr.col_expr_val[col]);
break;
default:
g_assert_not_reached();
@@ -1165,12 +1174,16 @@ set_fd_time(frame_data *fd, gchar *buf)
case TS_DELTA:
if (fd->flags.has_ts) {
+ nstime_t del_cap_ts;
+
+ frame_delta_abs_time(fd, fd->prev_cap, &del_cap_ts);
+
switch (timestamp_get_seconds_type()) {
case TS_SECONDS_DEFAULT:
- set_time_seconds(&fd->del_cap_ts, buf);
+ set_time_seconds(&del_cap_ts, buf);
break;
case TS_SECONDS_HOUR_MIN_SEC:
- set_time_hour_min_sec(&fd->del_cap_ts, buf);
+ set_time_hour_min_sec(&del_cap_ts, buf);
break;
default:
g_assert_not_reached();
@@ -1182,12 +1195,16 @@ set_fd_time(frame_data *fd, gchar *buf)
case TS_DELTA_DIS:
if (fd->flags.has_ts) {
+ nstime_t del_dis_ts;
+
+ frame_delta_abs_time(fd, fd->prev_dis, &del_dis_ts);
+
switch (timestamp_get_seconds_type()) {
case TS_SECONDS_DEFAULT:
- set_time_seconds(&fd->del_dis_ts, buf);
+ set_time_seconds(&del_dis_ts, buf);
break;
case TS_SECONDS_HOUR_MIN_SEC:
- set_time_hour_min_sec(&fd->del_dis_ts, buf);
+ set_time_hour_min_sec(&del_dis_ts, buf);
break;
default:
g_assert_not_reached();
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index e38a0a98cf..c8ce23df5e 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -258,13 +258,25 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
0, 0, &(pinfo->fd->abs_ts));
}
- item = proto_tree_add_time(fh_tree, hf_frame_time_delta, tvb,
- 0, 0, &(pinfo->fd->del_cap_ts));
- PROTO_ITEM_SET_GENERATED(item);
+ if (proto_field_is_referenced(tree, hf_frame_time_delta)) {
+ nstime_t del_cap_ts;
- item = proto_tree_add_time(fh_tree, hf_frame_time_delta_displayed, tvb,
- 0, 0, &(pinfo->fd->del_dis_ts));
- PROTO_ITEM_SET_GENERATED(item);
+ frame_delta_abs_time(pinfo->fd, pinfo->fd->prev_cap, &del_cap_ts);
+
+ item = proto_tree_add_time(fh_tree, hf_frame_time_delta, tvb,
+ 0, 0, &(del_cap_ts));
+ PROTO_ITEM_SET_GENERATED(item);
+ }
+
+ if (proto_field_is_referenced(tree, hf_frame_time_delta_displayed)) {
+ nstime_t del_dis_ts;
+
+ frame_delta_abs_time(pinfo->fd, pinfo->fd->prev_dis, &del_dis_ts);
+
+ item = proto_tree_add_time(fh_tree, hf_frame_time_delta_displayed, tvb,
+ 0, 0, &(del_dis_ts));
+ PROTO_ITEM_SET_GENERATED(item);
+ }
item = proto_tree_add_time(fh_tree, hf_frame_time_relative, tvb,
0, 0, &(pinfo->fd->rel_ts));
diff --git a/epan/frame_data.c b/epan/frame_data.c
index 922a655d70..e911f68ed3 100644
--- a/epan/frame_data.c
+++ b/epan/frame_data.c
@@ -121,15 +121,52 @@ p_remove_proto_data(frame_data *fd, int proto)
a lower time stamp than any frame with a non-reference time;
if both packets' times are reference times, we compare the
times of the packets. */
-#define COMPARE_TS(ts) \
+#define COMPARE_TS_REAL(time1, time2) \
((fdata1->flags.ref_time && !fdata2->flags.ref_time) ? -1 : \
(!fdata1->flags.ref_time && fdata2->flags.ref_time) ? 1 : \
- (fdata1->ts.secs < fdata2->ts.secs) ? -1 : \
- (fdata1->ts.secs > fdata2->ts.secs) ? 1 : \
- (fdata1->ts.nsecs < fdata2->ts.nsecs) ? -1 :\
- (fdata1->ts.nsecs > fdata2->ts.nsecs) ? 1 : \
+ ((time1).secs < (time2).secs) ? -1 : \
+ ((time1).secs > (time2).secs) ? 1 : \
+ ((time1).nsecs < (time2).nsecs) ? -1 :\
+ ((time1).nsecs > (time2).nsecs) ? 1 : \
COMPARE_FRAME_NUM())
+#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);
+}
+
gint
frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field)
{
@@ -150,10 +187,10 @@ frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field
return COMPARE_TS(rel_ts);
case TS_DELTA:
- return COMPARE_TS(del_cap_ts);
+ return frame_data_time_delta_compare(fdata1, fdata2);
case TS_DELTA_DIS:
- return COMPARE_TS(del_dis_ts);
+ return frame_data_time_delta_dis_compare(fdata1, fdata2);
case TS_NOT_SET:
return 0;
@@ -170,10 +207,10 @@ frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field
return COMPARE_TS(rel_ts);
case COL_DELTA_TIME:
- return COMPARE_TS(del_cap_ts);
+ return frame_data_time_delta_compare(fdata1, fdata2);
case COL_DELTA_TIME_DIS:
- return COMPARE_TS(del_dis_ts);
+ return frame_data_time_delta_dis_compare(fdata1, fdata2);
case COL_PACKET_LENGTH:
return COMPARE_NUM(pkt_len);
@@ -217,10 +254,8 @@ frame_data_init(frame_data *fdata, guint32 num,
fdata->shift_offset.nsecs = 0;
fdata->rel_ts.secs = 0;
fdata->rel_ts.nsecs = 0;
- fdata->del_dis_ts.secs = 0;
- fdata->del_dis_ts.nsecs = 0;
- fdata->del_cap_ts.secs = 0;
- fdata->del_cap_ts.nsecs = 0;
+ fdata->prev_dis = NULL;
+ fdata->prev_cap = NULL;
fdata->opt_comment = phdr->opt_comment;
}
@@ -228,8 +263,8 @@ void
frame_data_set_before_dissect(frame_data *fdata,
nstime_t *elapsed_time,
nstime_t *first_ts,
- nstime_t *prev_dis_ts,
- nstime_t *prev_cap_ts)
+ const frame_data *prev_dis,
+ const frame_data *prev_cap)
{
/* If we don't have the time stamp of the first packet in the
capture, it's because this is the first packet. Save the time
@@ -242,13 +277,6 @@ frame_data_set_before_dissect(frame_data *fdata,
if(fdata->flags.ref_time)
*first_ts = fdata->abs_ts;
- /* If we don't have the time stamp of the previous captured packet,
- it's because this is the first packet. Save the time
- stamp of this packet as the time stamp of the previous captured
- packet. */
- if (nstime_is_unset(prev_cap_ts))
- *prev_cap_ts = fdata->abs_ts;
-
/* Get the time elapsed between the first packet and this packet. */
nstime_delta(&fdata->rel_ts, &fdata->abs_ts, first_ts);
@@ -260,26 +288,13 @@ frame_data_set_before_dissect(frame_data *fdata,
*elapsed_time = fdata->rel_ts;
}
- /* Get the time elapsed between the previous displayed packet and
- this packet. */
- if (nstime_is_unset(prev_dis_ts))
- /* If we don't have the time stamp of the previous displayed packet,
- it's because we have no displayed packets prior to this.
- Set the delta time to zero. */
- nstime_set_zero(&fdata->del_dis_ts);
- else
- nstime_delta(&fdata->del_dis_ts, &fdata->abs_ts, prev_dis_ts);
-
- /* Get the time elapsed between the previous captured packet and
- this packet. */
- nstime_delta(&fdata->del_cap_ts, &fdata->abs_ts, prev_cap_ts);
- *prev_cap_ts = fdata->abs_ts;
+ fdata->prev_dis = prev_dis;
+ fdata->prev_cap = prev_cap;
}
void
frame_data_set_after_dissect(frame_data *fdata,
- guint32 *cum_bytes,
- nstime_t *prev_dis_ts)
+ guint32 *cum_bytes)
{
/* This frame either passed the display filter list or is marked as
a time reference frame. All time reference frames are displayed
@@ -293,10 +308,6 @@ frame_data_set_after_dissect(frame_data *fdata,
*cum_bytes += fdata->pkt_len;
fdata->cum_bytes = *cum_bytes;
}
-
- /* Set the time of the previous displayed frame to the time of this
- frame. */
- *prev_dis_ts = fdata->abs_ts;
}
void
diff --git a/epan/frame_data.h b/epan/frame_data.h
index 290693b4c9..87994cabf1 100644
--- a/epan/frame_data.h
+++ b/epan/frame_data.h
@@ -66,8 +66,8 @@ typedef struct _frame_data {
nstime_t abs_ts; /**< Absolute timestamp */
nstime_t shift_offset; /**< How much the abs_tm of the frame is shifted */
nstime_t rel_ts; /**< Relative timestamp (yes, it can be negative) */
- nstime_t del_dis_ts; /**< Delta timestamp to previous displayed frame (yes, it can be negative) */
- nstime_t del_cap_ts; /**< Delta timestamp to previous captured frame (yes, it can be negative) */
+ const struct _frame_data *prev_dis; /**< Previous displayed frame */
+ const struct _frame_data *prev_cap; /**< Previous captured frame */
gchar *opt_comment; /**< NULL if not available */
} frame_data;
@@ -103,18 +103,20 @@ extern void frame_data_cleanup(frame_data *fdata);
extern void frame_data_init(frame_data *fdata, guint32 num,
const struct wtap_pkthdr *phdr, gint64 offset,
guint32 cum_bytes);
+
+extern void frame_delta_abs_time(const frame_data *fdata,
+ const frame_data *prev, nstime_t *delta);
/**
* Sets the frame data struct values before dissection.
*/
extern void frame_data_set_before_dissect(frame_data *fdata,
nstime_t *elapsed_time,
nstime_t *first_ts,
- nstime_t *prev_dis_ts,
- nstime_t *prev_cap_ts);
+ const frame_data *prev_dis,
+ const frame_data *prev_cap);
extern void frame_data_set_after_dissect(frame_data *fdata,
- guint32 *cum_bytes,
- nstime_t *prev_dis_ts);
+ guint32 *cum_bytes);
#endif /* __FRAME_DATA__ */
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c
index 9d9c2ae285..5fecb5ea85 100644
--- a/epan/wslua/wslua_pinfo.c
+++ b/epan/wslua/wslua_pinfo.c
@@ -984,6 +984,15 @@ lua_nstime_to_sec(const nstime_t *nstime)
return (((double)nstime->secs) + (((double)nstime->nsecs) / 1000000000.0));
}
+static double
+lua_delta_nstime_to_sec(const frame_data *fd, const frame_data *prev)
+{
+ nstime_t del;
+
+ frame_delta_abs_time(fd, prev, &del);
+ return lua_nstime_to_sec(&del);
+}
+
PINFO_GET_BOOLEAN(Pinfo_fragmented,pinfo->ws_pinfo->fragmented)
PINFO_GET_BOOLEAN(Pinfo_in_error_pkt,pinfo->ws_pinfo->flags.in_error_pkt)
PINFO_GET_BOOLEAN(Pinfo_visited,pinfo->ws_pinfo->fd->flags.visited)
@@ -993,8 +1002,8 @@ PINFO_GET_NUMBER(Pinfo_len,pinfo->ws_pinfo->fd->pkt_len)
PINFO_GET_NUMBER(Pinfo_caplen,pinfo->ws_pinfo->fd->cap_len)
PINFO_GET_NUMBER(Pinfo_abs_ts,lua_nstime_to_sec(&pinfo->ws_pinfo->fd->abs_ts))
PINFO_GET_NUMBER(Pinfo_rel_ts,lua_nstime_to_sec(&pinfo->ws_pinfo->fd->rel_ts))
-PINFO_GET_NUMBER(Pinfo_delta_ts,lua_nstime_to_sec(&pinfo->ws_pinfo->fd->del_cap_ts))
-PINFO_GET_NUMBER(Pinfo_delta_dis_ts,lua_nstime_to_sec(&pinfo->ws_pinfo->fd->del_dis_ts))
+PINFO_GET_NUMBER(Pinfo_delta_ts,lua_delta_nstime_to_sec(pinfo->ws_pinfo->fd, pinfo->ws_pinfo->fd->prev_cap))
+PINFO_GET_NUMBER(Pinfo_delta_dis_ts,lua_delta_nstime_to_sec(pinfo->ws_pinfo->fd, pinfo->ws_pinfo->fd->prev_dis))
PINFO_GET_NUMBER(Pinfo_ipproto,pinfo->ws_pinfo->ipproto)
PINFO_GET_NUMBER(Pinfo_circuit_id,pinfo->ws_pinfo->circuit_id)
PINFO_GET_NUMBER(Pinfo_desegment_len,pinfo->ws_pinfo->desegment_len)
diff --git a/file.c b/file.c
index c04b336b9f..ced94b7d0b 100644
--- a/file.c
+++ b/file.c
@@ -81,8 +81,8 @@ gboolean auto_scroll_live;
static guint32 cum_bytes;
static nstime_t first_ts;
-static nstime_t prev_dis_ts;
-static nstime_t prev_cap_ts;
+static frame_data *prev_dis;
+static frame_data *prev_cap;
static gulong computed_elapsed;
@@ -332,8 +332,8 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
nstime_set_zero(&cf->elapsed_time);
nstime_set_unset(&first_ts);
- nstime_set_unset(&prev_dis_ts);
- nstime_set_unset(&prev_cap_ts);
+ prev_dis = NULL;
+ prev_cap = NULL;
cum_bytes = 0;
/* Adjust timestamp precision if auto is selected, col width will be adjusted */
@@ -1099,7 +1099,8 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
- &first_ts, &prev_dis_ts, &prev_cap_ts);
+ &first_ts, prev_dis, prev_cap);
+ prev_cap = fdata;
/* If either
+ we have a display filter and are re-applying it;
@@ -1153,7 +1154,8 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
if (fdata->flags.passed_dfilter || fdata->flags.ref_time)
{
- frame_data_set_after_dissect(fdata, &cum_bytes, &prev_dis_ts);
+ frame_data_set_after_dissect(fdata, &cum_bytes);
+ prev_dis = fdata;
/* If we haven't yet seen the first frame, this is it.
@@ -1836,8 +1838,8 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
to check whether it should be displayed and, if so, add it to
the display list. */
nstime_set_unset(&first_ts);
- nstime_set_unset(&prev_dis_ts);
- nstime_set_unset(&prev_cap_ts);
+ prev_dis = NULL;
+ prev_cap = NULL;
cum_bytes = 0;
/* Update the progress bar when it gets to this value. */
@@ -2077,7 +2079,7 @@ ref_time_packets(capture_file *cf)
frame_data *fdata;
nstime_set_unset(&first_ts);
- nstime_set_unset(&prev_dis_ts);
+ prev_dis = NULL;
cum_bytes = 0;
for (framenum = 1; framenum <= cf->count; framenum++) {
@@ -2106,8 +2108,8 @@ ref_time_packets(capture_file *cf)
it's because this is the first displayed packet. Save the time
stamp of this packet as the time stamp of the previous displayed
packet. */
- if (nstime_is_unset(&prev_dis_ts)) {
- prev_dis_ts = fdata->abs_ts;
+ if (prev_dis == NULL) {
+ prev_dis = fdata;
}
/* Get the time elapsed between the first packet and this packet. */
@@ -2124,8 +2126,8 @@ ref_time_packets(capture_file *cf)
/* If this frame is displayed, get the time elapsed between the
previous displayed packet and this packet. */
if ( fdata->flags.passed_dfilter ) {
- nstime_delta(&fdata->del_dis_ts, &fdata->abs_ts, &prev_dis_ts);
- prev_dis_ts = fdata->abs_ts;
+ fdata->prev_dis = prev_dis;
+ prev_dis = fdata;
}
/*
diff --git a/plugins/ethercat/packet-esl.c b/plugins/ethercat/packet-esl.c
index b3e1f9fc0b..34e6dfdfd8 100644
--- a/plugins/ethercat/packet-esl.c
+++ b/plugins/ethercat/packet-esl.c
@@ -252,8 +252,6 @@ void modify_times(tvbuff_t *tvb, gint offset, packet_info *pinfo)
pinfo->fd->abs_ts = ts;
nstime_add(&pinfo->fd->rel_ts, &ts_delta);
- nstime_add(&pinfo->fd->del_dis_ts, &ts_delta);
- nstime_add(&pinfo->fd->del_cap_ts, &ts_delta);
}
}
diff --git a/rawshark.c b/rawshark.c
index 7df9475fb2..d6f319ab76 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -120,8 +120,10 @@ static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_
static guint32 cum_bytes;
static nstime_t first_ts;
-static nstime_t prev_dis_ts;
-static nstime_t prev_cap_ts;
+static frame_data *prev_dis;
+static frame_data prev_dis_frame;
+static frame_data *prev_cap;
+static frame_data prev_cap_frame;
/*
* The way the packet decode is to be written.
@@ -1063,7 +1065,7 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
printf("%lu", (unsigned long int) cf->count);
frame_data_set_before_dissect(&fdata, &cf->elapsed_time,
- &first_ts, &prev_dis_ts, &prev_cap_ts);
+ &first_ts, prev_dis, prev_cap);
/* We only need the columns if we're printing packet info but we're
*not* verbose; in verbose mode, we print the protocol tree, not
@@ -1072,7 +1074,12 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
tap_push_tapped_queue(&edt);
- frame_data_set_after_dissect(&fdata, &cum_bytes, &prev_dis_ts);
+ frame_data_set_after_dissect(&fdata, &cum_bytes);
+ prev_dis_frame = fdata;
+ prev_dis = &prev_dis_frame;
+
+ prev_cap_frame = fdata;
+ prev_cap = &prev_cap_frame;
for(i = 0; i < n_rfilters; i++) {
/* Run the read filter if we have one. */
@@ -1587,8 +1594,8 @@ raw_cf_open(capture_file *cf, const char *fname)
cf->snap = WTAP_MAX_PACKET_SIZE;
nstime_set_zero(&cf->elapsed_time);
nstime_set_unset(&first_ts);
- nstime_set_unset(&prev_dis_ts);
- nstime_set_unset(&prev_cap_ts);
+ prev_dis = NULL;
+ prev_cap = NULL;
return CF_OK;
}
diff --git a/tshark.c b/tshark.c
index 9e1cf2c22a..118c75e205 100644
--- a/tshark.c
+++ b/tshark.c
@@ -103,8 +103,10 @@ static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_
static guint32 cum_bytes;
static nstime_t first_ts;
-static nstime_t prev_dis_ts;
-static nstime_t prev_cap_ts;
+static frame_data *prev_dis;
+static frame_data prev_dis_frame;
+static frame_data *prev_cap;
+static frame_data prev_cap_frame;
static gboolean print_packet_info; /* TRUE if we're to print packet information */
static const char* prev_display_dissector_name = NULL;
@@ -2561,7 +2563,7 @@ process_packet_first_pass(capture_file *cf,
epan_dissect_prime_dfilter(&edt, cf->rfcode);
frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time,
- &first_ts, &prev_dis_ts, &prev_cap_ts);
+ &first_ts, prev_dis, prev_cap);
epan_dissect_run(&edt, pseudo_header, pd, &fdlocal, NULL);
@@ -2571,11 +2573,16 @@ process_packet_first_pass(capture_file *cf,
}
if (passed) {
- frame_data_set_after_dissect(&fdlocal, &cum_bytes, &prev_dis_ts);
+ frame_data_set_after_dissect(&fdlocal, &cum_bytes);
+ prev_dis_frame = fdlocal;
+ prev_dis = &prev_dis_frame;
frame_data_sequence_add(cf->frames, &fdlocal);
cf->count++;
}
+ prev_cap_frame = fdlocal;
+ prev_cap = &prev_cap_frame;
+
if (do_dissection)
epan_dissect_cleanup(&edt);
@@ -3096,7 +3103,7 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
cinfo = NULL;
frame_data_set_before_dissect(&fdata, &cf->elapsed_time,
- &first_ts, &prev_dis_ts, &prev_cap_ts);
+ &first_ts, prev_dis, prev_cap);
epan_dissect_run(&edt, pseudo_header, pd, &fdata, cinfo);
@@ -3108,7 +3115,9 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
}
if (passed) {
- frame_data_set_after_dissect(&fdata, &cum_bytes, &prev_dis_ts);
+ frame_data_set_after_dissect(&fdata, &cum_bytes);
+ prev_dis_frame = fdata;
+ prev_dis = &prev_dis_frame;
/* Process this packet. */
if (print_packet_info) {
@@ -3149,6 +3158,9 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
}
}
+ prev_cap_frame = fdata;
+ prev_cap = &prev_cap_frame;
+
if (do_dissection) {
epan_dissect_cleanup(&edt);
frame_data_cleanup(&fdata);
@@ -3577,8 +3589,8 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
cf->has_snap = TRUE;
nstime_set_zero(&cf->elapsed_time);
nstime_set_unset(&first_ts);
- nstime_set_unset(&prev_dis_ts);
- nstime_set_unset(&prev_cap_ts);
+ prev_dis = NULL;
+ prev_cap = NULL;
cf->state = FILE_READ_IN_PROGRESS;
diff --git a/ui/gtk/time_shift_dlg.c b/ui/gtk/time_shift_dlg.c
index 37ad3eeb38..57a31c8155 100644
--- a/ui/gtk/time_shift_dlg.c
+++ b/ui/gtk/time_shift_dlg.c
@@ -938,15 +938,11 @@ static void
modify_time_perform(frame_data *fd, int neg, nstime_t *offset, int settozero)
{
static frame_data *first_packet = NULL;
- static frame_data *lastdisplayed_packet = NULL;
- static frame_data *prevcaptured_packet = NULL;
static nstime_t nulltime;
/* Only for initializing */
if (offset == NULL) {
first_packet = fd;
- lastdisplayed_packet = NULL;
- prevcaptured_packet = NULL;
nulltime.secs = nulltime.nsecs = 0;
return;
}
@@ -974,28 +970,10 @@ modify_time_perform(frame_data *fd, int neg, nstime_t *offset, int settozero)
/*
* rel_ts - Relative timestamp to first packet
- * del_dis_ts - Delta timestamp to previous displayed frame
- * del_cap_ts - Delta timestamp to previous captured frame
*/
if (first_packet != NULL) {
nstime_copy(&(fd->rel_ts), &(fd->abs_ts));
nstime_subtract(&(fd->rel_ts), &(first_packet->abs_ts));
} else
nstime_copy(&(fd->rel_ts), &nulltime);
-
- if (prevcaptured_packet != NULL) {
- nstime_copy(&(fd->del_cap_ts), &(fd->abs_ts));
- nstime_subtract(&(fd->del_cap_ts), &(prevcaptured_packet->abs_ts));
- } else
- nstime_copy(&(fd->del_cap_ts), &nulltime);
-
- if (lastdisplayed_packet != NULL) {
- nstime_copy(&(fd->del_dis_ts), &(fd->abs_ts));
- nstime_subtract(&(fd->del_dis_ts), &(lastdisplayed_packet->abs_ts));
- } else
- nstime_copy(&(fd->del_dis_ts), &nulltime);
-
- prevcaptured_packet = fd;
- if (fd->flags.passed_dfilter)
- lastdisplayed_packet = fd;
}