aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Fisher <steve@stephen-fisher.com>2007-03-23 18:08:17 +0000
committerStephen Fisher <steve@stephen-fisher.com>2007-03-23 18:08:17 +0000
commit6d8d2854c8cf998605e041987610986d09375c6a (patch)
tree49c7db39b4c44d02429daa16149f2ba63678af4e
parent62f88a4a04d8e300ff108f6164e9016e8cdcc9c3 (diff)
From Sake Blok:
Fix for bug #491: Unexpected frame.time_delta behavior This patch ... fixes bug 491. It does this by changing the behaviour of the frame.time_delta field so it reflects the delta time between captured packets (tshark already did this). To keep the delta time between displayed packets, the field frame.time_delta_displayed is created. svn path=/trunk/; revision=21154
-rw-r--r--doc/wireshark.pod7
-rw-r--r--docbook/wsug_src/WSUG_chapter_use.xml18
-rw-r--r--docbook/wsug_src/WSUG_chapter_work.xml7
-rw-r--r--epan/column-utils.c68
-rw-r--r--epan/column.c10
-rw-r--r--epan/column_info.h1
-rw-r--r--epan/dissectors/packet-frame.c16
-rw-r--r--epan/frame_data.h3
-rw-r--r--epan/timestamp.h3
-rw-r--r--epan/wslua/wslua_pinfo.c9
-rw-r--r--file.c18
-rw-r--r--gtk/main.c4
-rw-r--r--gtk/menu.c23
-rw-r--r--gtk/packet_list.c10
-rw-r--r--tshark.c36
15 files changed, 190 insertions, 43 deletions
diff --git a/doc/wireshark.pod b/doc/wireshark.pod
index 4f8aacb3ea..40f85117ab 100644
--- a/doc/wireshark.pod
+++ b/doc/wireshark.pod
@@ -30,7 +30,7 @@ S<[ B<-r> E<lt>infileE<gt> ]>
S<[ B<-R> E<lt>read (display) filterE<gt> ]>
S<[ B<-S> ]>
S<[ B<-s> E<lt>capture snaplenE<gt> ]>
-S<[ B<-t> ad|a|r|d|e ]>
+S<[ B<-t> ad|a|r|d|dd|e ]>
S<[ B<-v> ]>
S<[ B<-w> E<lt>outfileE<gt> ]>
S<[ B<-y> E<lt>capture link typeE<gt> ]>
@@ -390,7 +390,7 @@ Set the default snapshot length to use when capturing live data.
No more than I<snaplen> bytes of each network packet will be read into
memory, or saved to disk.
-=item -t ad|a|r|d|e
+=item -t ad|a|r|d|dd|e
Set the format of the packet timestamp displayed in the packet list
window, the default is relative. The format can be one of:
@@ -407,6 +407,9 @@ and the current packet
B<d> delta: The delta time is the time since the previous packet was
captured
+B<dd> delta_displayed: The delta_displayed time is the time since the
+previous displayed packet was captured
+
B<e> epoch: The time in seconds since epoch (Jan 1, 1970 00:00:00)
=item -v
diff --git a/docbook/wsug_src/WSUG_chapter_use.xml b/docbook/wsug_src/WSUG_chapter_use.xml
index 6067017b04..f4118cc7dc 100644
--- a/docbook/wsug_src/WSUG_chapter_use.xml
+++ b/docbook/wsug_src/WSUG_chapter_use.xml
@@ -792,8 +792,9 @@
<note><title>Note!</title>
<para>
The fields "Time of Day", "Date and Time of
- Day", "Seconds Since Beginning of Capture" and "Seconds Since
- Previous Packet" are mutually exclusive.
+ Day", "Seconds Since Beginning of Capture", "Seconds Since
+ Previous Captured Packet" and "Seconds Since Previous
+ Displayed Packet" are mutually exclusive.
</para>
</note>
</para></entry>
@@ -817,11 +818,20 @@
</para></entry>
</row>
<row>
- <entry><command>Time Display Format > Seconds Since Previous Packet: 1.123456</command></entry>
+ <entry><command>Time Display Format > Seconds Since Previous Captured Packet: 1.123456</command></entry>
<entry></entry>
<entry><para>
Selecting this tells Wireshark to display time stamps in
- seconds since previous packet format, see
+ seconds since previous captured packet format, see
+ <xref linkend="ChWorkTimeFormatsSection"/>.
+ </para></entry>
+ </row>
+ <row>
+ <entry><command>Time Display Format > Seconds Since Previous Displayed Packet: 1.123456</command></entry>
+ <entry></entry>
+ <entry><para>
+ Selecting this tells Wireshark to display time stamps in
+ seconds since previous displayed packet format, see
<xref linkend="ChWorkTimeFormatsSection"/>.
</para></entry>
</row>
diff --git a/docbook/wsug_src/WSUG_chapter_work.xml b/docbook/wsug_src/WSUG_chapter_work.xml
index 10f1505ec3..493637263e 100644
--- a/docbook/wsug_src/WSUG_chapter_work.xml
+++ b/docbook/wsug_src/WSUG_chapter_work.xml
@@ -1406,8 +1406,11 @@ eth.src[1-2] == 00:83
"Time Reference" before this packet (see <xref
linkend="ChWorkTimeReferencePacketSection"/>).</para>
</listitem>
- <listitem><para><command>Seconds Since Previous Packet: 1.123456</command>
- The time relative to the previous packet.</para>
+ <listitem><para><command>Seconds Since Previous Captured Packet: 1.123456</command>
+ The time relative to the previous captured packet.</para>
+ </listitem>
+ <listitem><para><command>Seconds Since Previous Displayed Packet: 1.123456</command>
+ The time relative to the previous displayed packet.</para>
</listitem>
</itemizedlist>
</para>
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 3aa5acd81a..2793119609 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -666,32 +666,32 @@ col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
case(TS_PREC_FIXED_SEC):
case(TS_PREC_AUTO_SEC):
display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
- (gint32) fd->del_ts.secs, fd->del_ts.nsecs / 1000000000, SECS);
+ (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 1000000000, SECS);
break;
case(TS_PREC_FIXED_DSEC):
case(TS_PREC_AUTO_DSEC):
display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
- (gint32) fd->del_ts.secs, fd->del_ts.nsecs / 100000000, DSECS);
+ (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 100000000, DSECS);
break;
case(TS_PREC_FIXED_CSEC):
case(TS_PREC_AUTO_CSEC):
display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
- (gint32) fd->del_ts.secs, fd->del_ts.nsecs / 10000000, CSECS);
+ (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 10000000, CSECS);
break;
case(TS_PREC_FIXED_MSEC):
case(TS_PREC_AUTO_MSEC):
display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
- (gint32) fd->del_ts.secs, fd->del_ts.nsecs / 1000000, MSECS);
+ (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 1000000, MSECS);
break;
case(TS_PREC_FIXED_USEC):
case(TS_PREC_AUTO_USEC):
display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
- (gint32) fd->del_ts.secs, fd->del_ts.nsecs / 1000, USECS);
+ (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 1000, USECS);
break;
case(TS_PREC_FIXED_NSEC):
case(TS_PREC_AUTO_NSEC):
display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
- (gint32) fd->del_ts.secs, fd->del_ts.nsecs, NSECS);
+ (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs, NSECS);
break;
default:
g_assert_not_reached();
@@ -701,6 +701,50 @@ col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
}
+static void
+col_set_delta_time_dis(frame_data *fd, column_info *cinfo, int col)
+{
+ COL_CHECK_REF_TIME(fd, cinfo, col);
+
+ switch(timestamp_get_precision()) {
+ case(TS_PREC_FIXED_SEC):
+ case(TS_PREC_AUTO_SEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 1000000000, SECS);
+ break;
+ case(TS_PREC_FIXED_DSEC):
+ case(TS_PREC_AUTO_DSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 100000000, DSECS);
+ break;
+ case(TS_PREC_FIXED_CSEC):
+ case(TS_PREC_AUTO_CSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 10000000, CSECS);
+ break;
+ case(TS_PREC_FIXED_MSEC):
+ case(TS_PREC_AUTO_MSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 1000000, MSECS);
+ break;
+ case(TS_PREC_FIXED_USEC):
+ case(TS_PREC_AUTO_USEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 1000, USECS);
+ break;
+ case(TS_PREC_FIXED_NSEC):
+ case(TS_PREC_AUTO_NSEC):
+ display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
+ fd->del_dis_ts.secs, fd->del_dis_ts.nsecs, NSECS);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ cinfo->col_data[col] = cinfo->col_buf[col];
+ strcpy(cinfo->col_expr[col],"frame.time_delta_displayed");
+ strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
+}
+
/* To do: Add check_col checks to the col_add* routines */
static void
@@ -849,10 +893,16 @@ col_set_cls_time(frame_data *fd, column_info *cinfo, gint col)
case TS_DELTA:
col_set_delta_time(fd, cinfo, col);
break;
+
+ case TS_DELTA_DIS:
+ col_set_delta_time_dis(fd, cinfo, col);
+ break;
+
case TS_EPOCH:
col_set_epoch_time(fd, cinfo, col);
break;
- case TS_NOT_SET:
+
+ case TS_NOT_SET:
/* code is missing for this case, but I don't know which [jmayer20051219] */
g_assert(FALSE);
break;
@@ -1151,6 +1201,10 @@ col_fill_in(packet_info *pinfo)
col_set_delta_time(pinfo->fd, pinfo->cinfo, i);
break;
+ case COL_DELTA_TIME_DIS:
+ col_set_delta_time_dis(pinfo->fd, pinfo->cinfo, i);
+ break;
+
case COL_DEF_SRC:
case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
col_set_addr(pinfo, i, &pinfo->src, TRUE, TRUE);
diff --git a/epan/column.c b/epan/column.c
index f84b338933..135b57e8e0 100644
--- a/epan/column.c
+++ b/epan/column.c
@@ -51,6 +51,7 @@ col_format_to_string(gint fmt) {
"%At",
"%Yt",
"%Tt",
+ "%Gt",
"%s",
"%rs",
"%us",
@@ -116,6 +117,7 @@ static const gchar *dlist[NUM_COL_FMTS] = {
"Absolute time", /* COL_ABS_TIME */
"Absolute date and time", /* COL_ABS_DATE_TIME */
"Delta time", /* COL_DELTA_TIME */
+ "Delta time displayed", /* COL_DELTA_TIME_DIS */
"Source address", /* COL_DEF_SRC */
"Src addr (resolved)", /* COL_RES_SRC */
"Src addr (unresolved)", /* COL_UNRES_SRC */
@@ -355,6 +357,7 @@ get_timestamp_column_longest_string(gint type, gint precision)
break;
case(TS_RELATIVE): /* fallthrough */
case(TS_DELTA):
+ case(TS_DELTA_DIS):
switch(precision) {
case(TS_PREC_AUTO_SEC):
case(TS_PREC_FIXED_SEC):
@@ -472,6 +475,9 @@ get_column_longest_string(gint format)
case COL_DELTA_TIME:
return get_timestamp_column_longest_string(TS_DELTA, timestamp_get_precision());
break;
+ case COL_DELTA_TIME_DIS:
+ return get_timestamp_column_longest_string(TS_DELTA_DIS, timestamp_get_precision());
+ break;
case COL_DEF_SRC:
case COL_RES_SRC:
case COL_UNRES_SRC:
@@ -581,6 +587,7 @@ get_column_char_width(gint format)
#define TIME_ABS 2
#define DATE_TIME_ABS 3
#define TIME_DEL 4
+#define TIME_DEL_DIS 5
#define RES_DEF 0
#define RES_DO 1
@@ -672,6 +679,9 @@ get_column_format_from_str(gchar *str) {
case 'T':
time_off = TIME_DEL;
break;
+ case 'G': /* Todo: use a better letter for time since last displayed packet */
+ time_off = TIME_DEL_DIS;
+ break;
case 'L':
return COL_PACKET_LENGTH;
break;
diff --git a/epan/column_info.h b/epan/column_info.h
index ad91439d4d..67e0ebd21f 100644
--- a/epan/column_info.h
+++ b/epan/column_info.h
@@ -62,6 +62,7 @@ enum {
COL_ABS_TIME, /* Absolute time */
COL_ABS_DATE_TIME, /* Absolute date and time */
COL_DELTA_TIME, /* Delta time */
+ COL_DELTA_TIME_DIS, /* Delta time displayed*/
COL_DEF_SRC, /* Source address */
COL_RES_SRC, /* Resolved source */
COL_UNRES_SRC, /* Unresolved source */
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index 59bd538728..778154606f 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -43,6 +43,7 @@ int proto_frame = -1;
int hf_frame_arrival_time = -1;
static int hf_frame_time_invalid = -1;
static int hf_frame_time_delta = -1;
+static int hf_frame_time_delta_displayed = -1;
static int hf_frame_time_relative = -1;
int hf_frame_number = -1;
int hf_frame_packet_len = -1; /* Deprecated in favor of hf_frame_len */
@@ -195,12 +196,18 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "Arrival Time: Fractional second out of range (0-1000000000)");
}
- ts = pinfo->fd->del_ts;
+ ts = pinfo->fd->del_cap_ts;
item = proto_tree_add_time(fh_tree, hf_frame_time_delta, tvb,
0, 0, &ts);
PROTO_ITEM_SET_GENERATED(item);
+ ts = pinfo->fd->del_dis_ts;
+
+ item = proto_tree_add_time(fh_tree, hf_frame_time_delta_displayed, tvb,
+ 0, 0, &ts);
+ PROTO_ITEM_SET_GENERATED(item);
+
ts = pinfo->fd->rel_ts;
item = proto_tree_add_time(fh_tree, hf_frame_time_relative, tvb,
@@ -462,7 +469,12 @@ proto_register_frame(void)
"The timestamp from the capture is out of the valid range", HFILL }},
{ &hf_frame_time_delta,
- { "Time delta from previous displayed frame", "frame.time_delta", FT_RELATIVE_TIME, BASE_NONE, NULL,
+ { "Time delta from previous captured frame", "frame.time_delta", FT_RELATIVE_TIME, BASE_NONE, NULL,
+ 0x0,
+ "Time delta from previous captured frame", HFILL }},
+
+ { &hf_frame_time_delta_displayed,
+ { "Time delta from previous displayed frame", "frame.time_delta_displayed", FT_RELATIVE_TIME, BASE_NONE, NULL,
0x0,
"Time delta from previous displayed frame", HFILL }},
diff --git a/epan/frame_data.h b/epan/frame_data.h
index e6baff2ea5..52f9ef798c 100644
--- a/epan/frame_data.h
+++ b/epan/frame_data.h
@@ -46,7 +46,8 @@ typedef struct _frame_data {
guint32 cum_bytes; /* Cumulative bytes into the capture */
nstime_t abs_ts; /* Absolute timestamp */
nstime_t rel_ts; /* Relative timestamp (yes, it can be negative) */
- nstime_t del_ts; /* Delta 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) */
gint64 file_off; /* File offset */
int lnk_t; /* Per-packet encapsulation/data-link type */
struct {
diff --git a/epan/timestamp.h b/epan/timestamp.h
index 3e22c6222e..bf45d3f8b6 100644
--- a/epan/timestamp.h
+++ b/epan/timestamp.h
@@ -32,7 +32,8 @@ typedef enum {
TS_RELATIVE, /* Since start of capture */
TS_ABSOLUTE,
TS_ABSOLUTE_WITH_DATE,
- TS_DELTA, /* Since previous packet */
+ TS_DELTA, /* Since previous captured packet */
+ TS_DELTA_DIS, /* Since previous displayed packet */
TS_EPOCH, /* Seconds (and fractions) since epoch */
/*
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c
index 4e0168fa01..3aa8e78d80 100644
--- a/epan/wslua/wslua_pinfo.c
+++ b/epan/wslua/wslua_pinfo.c
@@ -296,6 +296,7 @@ static const struct col_names_t colnames[] = {
{"rel_time",COL_REL_TIME},
{"date",COL_ABS_DATE_TIME},
{"delta_time",COL_DELTA_TIME},
+ {"delta_time_displayed",COL_DELTA_TIME_DIS},
{"src",COL_DEF_SRC},
{"src_res",COL_RES_SRC},
{"src_unres",COL_UNRES_SRC},
@@ -583,7 +584,8 @@ PINFO_GET_NUMBER(Pinfo_len,pinfo->fd->pkt_len)
PINFO_GET_NUMBER(Pinfo_caplen,pinfo->fd->cap_len)
PINFO_GET_NUMBER(Pinfo_abs_ts,(((double)pinfo->fd->abs_ts.secs) + (((double)pinfo->fd->abs_ts.nsecs) / 1000000000.0) ))
PINFO_GET_NUMBER(Pinfo_rel_ts,(((double)pinfo->fd->rel_ts.secs) + (((double)pinfo->fd->rel_ts.nsecs) / 1000000000.0) ))
-PINFO_GET_NUMBER(Pinfo_delta_ts,(((double)pinfo->fd->del_ts.secs) + (((double)pinfo->fd->del_ts.nsecs) / 1000000000.0) ))
+PINFO_GET_NUMBER(Pinfo_delta_ts,(((double)pinfo->fd->del_cap_ts.secs) + (((double)pinfo->fd->del_cap_ts.nsecs) / 1000000000.0) ))
+PINFO_GET_NUMBER(Pinfo_delta_dis_ts,(((double)pinfo->fd->del_dis_ts.secs) + (((double)pinfo->fd->del_dis_ts.nsecs) / 1000000000.0) ))
PINFO_GET_NUMBER(Pinfo_ipproto,pinfo->ipproto)
PINFO_GET_NUMBER(Pinfo_circuit_id,pinfo->circuit_id)
PINFO_GET_NUMBER(Pinfo_ptype,pinfo->ptype)
@@ -769,9 +771,12 @@ static const pinfo_method_t Pinfo_methods[] = {
/* WSLUA_ATTRIBUTE Pinfo_rel_ts RO Number of seconds passed since beginning of capture */
{"rel_ts",Pinfo_rel_ts, pushnil_param, PARAM_NONE },
- /* WSLUA_ATTRIBUTE Pinfo_delta_ts RO Number of seconds passed since the last packet */
+ /* WSLUA_ATTRIBUTE Pinfo_delta_ts RO Number of seconds passed since the last captured packet */
{"delta_ts",Pinfo_delta_ts, pushnil_param, PARAM_NONE },
+ /* WSLUA_ATTRIBUTE Pinfo_delta_dis_ts RO Number of seconds passed since the last displayed packet */
+ {"delta_dis_ts",Pinfo_delta_dis_ts, pushnil_param, PARAM_NONE },
+
/* WSLUA_ATTRIBUTE Pinfo_visited RO Whether this packet hass been already visited */
{"visited",Pinfo_visited, pushnil_param, PARAM_NONE },
diff --git a/file.c b/file.c
index 0039274867..1e739f4e0c 100644
--- a/file.c
+++ b/file.c
@@ -83,7 +83,7 @@ gboolean auto_scroll_live;
#endif
static nstime_t first_ts;
-static nstime_t prev_ts;
+static nstime_t prev_dis_ts;
static guint32 cum_bytes = 0;
static void cf_reset_state(capture_file *cf);
@@ -253,7 +253,7 @@ 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_zero(&first_ts);
- nstime_set_zero(&prev_ts);
+ nstime_set_zero(&prev_dis_ts);
cf->plist_chunk = g_mem_chunk_new("frame_data_chunk",
sizeof(frame_data),
@@ -908,8 +908,8 @@ add_packet_to_packet_list(frame_data *fdata, 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_zero(&prev_ts)) {
- prev_ts = fdata->abs_ts;
+ if (nstime_is_zero(&prev_dis_ts)) {
+ prev_dis_ts = fdata->abs_ts;
}
/* Get the time elapsed between the first packet and this packet. */
@@ -925,7 +925,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
/* Get the time elapsed between the previous displayed packet and
this packet. */
- nstime_delta(&fdata->del_ts, &fdata->abs_ts, &prev_ts);
+ nstime_delta(&fdata->del_dis_ts, &fdata->abs_ts, &prev_dis_ts);
/* If either
@@ -1015,7 +1015,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
/* Set the time of the previous displayed frame to the time of this
frame. */
- prev_ts = fdata->abs_ts;
+ prev_dis_ts = fdata->abs_ts;
cf->displayed_count++;
} else {
@@ -1059,6 +1059,10 @@ read_packet(capture_file *cf, dfilter_t *dfcode, gint64 offset)
fdata->color_filter = NULL;
fdata->abs_ts = *((nstime_t *) &phdr->ts);
+ if (cf->plist_end != NULL)
+ nstime_delta(&fdata->del_cap_ts, &fdata->abs_ts, &cf->plist_end->abs_ts);
+ else
+ nstime_set_zero(&fdata->del_cap_ts);
passed = TRUE;
if (cf->rfcode) {
@@ -1495,7 +1499,7 @@ 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_zero(&first_ts);
- nstime_set_zero(&prev_ts);
+ nstime_set_zero(&prev_dis_ts);
/* Update the progress bar when it gets to this value. */
progbar_nextstep = 0;
diff --git a/gtk/main.c b/gtk/main.c
index 028a5b619e..f931e6a9a5 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1263,7 +1263,7 @@ print_usage(gboolean print_ver) {
fprintf(output, "User interface:\n");
fprintf(output, " -g <packet number> go to specified packet number after \"-r\"\n");
fprintf(output, " -m <font> set the font name used for most text\n");
- fprintf(output, " -t ad|a|r|d|e output format of time stamps (def: r: rel. to first)\n");
+ fprintf(output, " -t ad|a|r|d|dd|e output format of time stamps (def: r: rel. to first)\n");
fprintf(output, " -X <key>:<value> eXtension options, see man page for details\n");
fprintf(output, " -z <statistics> show various statistics, see man page for details\n");
@@ -2669,6 +2669,8 @@ main(int argc, char *argv[])
timestamp_set_type(TS_ABSOLUTE_WITH_DATE);
else if (strcmp(optarg, "d") == 0)
timestamp_set_type(TS_DELTA);
+ else if (strcmp(optarg, "dd") == 0)
+ timestamp_set_type(TS_DELTA_DIS);
else if (strcmp(optarg, "e") == 0)
timestamp_set_type(TS_EPOCH);
else {
diff --git a/gtk/menu.c b/gtk/menu.c
index b8c5ee1241..0cbf1075f4 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -126,6 +126,7 @@ static void timestamp_absolute_cb(GtkWidget *w _U_, gpointer d _U_);
static void timestamp_absolute_date_cb(GtkWidget *w _U_, gpointer d _U_);
static void timestamp_relative_cb(GtkWidget *w _U_, gpointer d _U_);
static void timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_);
+static void timestamp_delta_dis_cb(GtkWidget *w _U_, gpointer d _U_);
static void timestamp_epoch_cb(GtkWidget *w _U_, gpointer d _U_);
static void timestamp_auto_cb(GtkWidget *w _U_, gpointer d _U_);
static void timestamp_sec_cb(GtkWidget *w _U_, gpointer d _U_);
@@ -487,7 +488,9 @@ static GtkItemFactoryEntry menu_items[] =
0, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL),
ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456", NULL, timestamp_relative_cb,
0, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL),
- ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Previous Packet: 1.123456", NULL, timestamp_delta_cb,
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456", NULL, timestamp_delta_cb,
+ 0, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL),
+ ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456", NULL, timestamp_delta_dis_cb,
0, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL),
ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456", NULL, timestamp_epoch_cb,
0, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL),
@@ -1689,6 +1692,16 @@ timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_)
}
static void
+timestamp_delta_dis_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ if (recent.gui_time_format != TS_DELTA_DIS) {
+ timestamp_set_type(TS_DELTA_DIS);
+ recent.gui_time_format = TS_DELTA_DIS;
+ cf_change_time_formats(&cfile);
+ }
+}
+
+static void
timestamp_epoch_cb(GtkWidget *w _U_, gpointer d _U_)
{
if (recent.gui_time_format != TS_EPOCH) {
@@ -1942,7 +1955,13 @@ menu_recent_read_finished(void) {
break;
case(TS_DELTA):
menu = gtk_item_factory_get_widget(main_menu_factory,
- "/View/Time Display Format/Seconds Since Previous Packet: 1.123456");
+ "/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456");
+ recent.gui_time_format = -1;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
+ break;
+ case(TS_DELTA_DIS):
+ menu = gtk_item_factory_get_widget(main_menu_factory,
+ "/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456");
recent.gui_time_format = -1;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
break;
diff --git a/gtk/packet_list.c b/gtk/packet_list.c
index 7a1b5c9ec7..8ee1ad8996 100644
--- a/gtk/packet_list.c
+++ b/gtk/packet_list.c
@@ -170,7 +170,10 @@ packet_list_compare(EthCList *clist, gconstpointer ptr1, gconstpointer ptr2)
return COMPARE_TS(rel_ts);
case TS_DELTA:
- return COMPARE_TS(del_ts);
+ return COMPARE_TS(del_cap_ts);
+
+ case TS_DELTA_DIS:
+ return COMPARE_TS(del_dis_ts);
case TS_NOT_SET:
return 0;
@@ -185,7 +188,10 @@ packet_list_compare(EthCList *clist, gconstpointer ptr1, gconstpointer ptr2)
return COMPARE_TS(rel_ts);
case COL_DELTA_TIME:
- return COMPARE_TS(del_ts);
+ return COMPARE_TS(del_cap_ts);
+
+ case COL_DELTA_TIME_DIS:
+ return COMPARE_TS(del_dis_ts);
case COL_PACKET_LENGTH:
return COMPARE_NUM(pkt_len);
diff --git a/tshark.c b/tshark.c
index 74a02dd14e..91500e395e 100644
--- a/tshark.c
+++ b/tshark.c
@@ -116,7 +116,8 @@
static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_as_protocol>";
static nstime_t first_ts;
-static nstime_t prev_ts;
+static nstime_t prev_dis_ts;
+static nstime_t prev_cap_ts;
static GString *comp_info_str, *runtime_info_str;
static gboolean print_packet_info; /* TRUE if we're to print packet information */
@@ -276,7 +277,7 @@ print_usage(gboolean print_ver)
fprintf(output, " -S display packets even when writing to a file\n");
fprintf(output, " -x add output of hex and ASCII dump (Packet Bytes)\n");
fprintf(output, " -T pdml|ps|psml|text output format of text output (def: text)\n");
- fprintf(output, " -t ad|a|r|d|e output format of time stamps (def: r: rel. to first)\n");
+ fprintf(output, " -t ad|a|r|d|dd|e output format of time stamps (def: r: rel. to first)\n");
fprintf(output, " -l flush output after each packet\n");
fprintf(output, " -q be more quiet on stdout (e.g. when using statistics)\n");
fprintf(output, " -X <key>:<value> eXtension options, see the man page for details\n");
@@ -1034,6 +1035,8 @@ main(int argc, char *argv[])
timestamp_set_type(TS_ABSOLUTE_WITH_DATE);
else if (strcmp(optarg, "d") == 0)
timestamp_set_type(TS_DELTA);
+ else if (strcmp(optarg, "dd") == 0)
+ timestamp_set_type(TS_DELTA_DIS);
else if (strcmp(optarg, "e") == 0)
timestamp_set_type(TS_EPOCH);
else {
@@ -2242,12 +2245,12 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
first_ts = fdata->abs_ts;
}
- /* If we don't have the time stamp of the previous displayed packet,
- it's because this is the first displayed packet. Save the time
- stamp of this packet as the time stamp of the previous displayed
+ /* 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_zero(&prev_ts)) {
- prev_ts = fdata->abs_ts;
+ if (nstime_is_zero(&prev_cap_ts)) {
+ prev_cap_ts = fdata->abs_ts;
}
/* Get the time elapsed between the first packet and this packet. */
@@ -2263,8 +2266,15 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
/* Get the time elapsed between the previous displayed packet and
this packet. */
- nstime_delta(&fdata->del_ts, &fdata->abs_ts, &prev_ts);
- prev_ts = fdata->abs_ts;
+ if (nstime_is_zero(&prev_dis_ts))
+ 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;
}
/* Free up all data attached to a "frame_data" structure. */
@@ -2341,6 +2351,11 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
}
if (passed) {
+ /* Keep the time of the current packet if the packet passed
+ the read filter so that the delta time since last displayed
+ packet can be calculated */
+ prev_dis_ts = fdata.abs_ts;
+
/* Process this packet. */
if (print_packet_info) {
/* We're printing packet information; print the information for
@@ -2963,7 +2978,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_zero(&first_ts);
- nstime_set_zero(&prev_ts);
+ nstime_set_zero(&prev_dis_ts);
+ nstime_set_zero(&prev_cap_ts);
return CF_OK;