parent
a3d3282e64
commit
0fc9e207d2
|
@ -50,6 +50,26 @@ gboolean nstime_is_zero(nstime_t *nstime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set the given nstime_t to (0,maxint) to mark it as "unset"
|
||||||
|
* That way we can find the first frame even when a timestamp
|
||||||
|
* is zero (fix for bug 1056)
|
||||||
|
*/
|
||||||
|
void nstime_set_unset(nstime_t *nstime)
|
||||||
|
{
|
||||||
|
nstime->secs = 0;
|
||||||
|
nstime->nsecs = G_MAXINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* is the given nstime_t currently (0,maxint)? */
|
||||||
|
gboolean nstime_is_unset(nstime_t *nstime)
|
||||||
|
{
|
||||||
|
if(nstime->secs == 0 && nstime->nsecs == G_MAXINT) {
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* function: nstime_delta
|
* function: nstime_delta
|
||||||
|
|
|
@ -42,6 +42,15 @@ extern void nstime_set_zero(nstime_t *nstime);
|
||||||
/* is the given nstime_t currently zero? */
|
/* is the given nstime_t currently zero? */
|
||||||
extern gboolean nstime_is_zero(nstime_t *nstime);
|
extern gboolean nstime_is_zero(nstime_t *nstime);
|
||||||
|
|
||||||
|
/* set the given nstime_t to (0,maxint) to mark it as "unset"
|
||||||
|
* That way we can find the first frame even when a timestamp
|
||||||
|
* is zero (fix for bug 1056)
|
||||||
|
*/
|
||||||
|
extern void nstime_set_unset(nstime_t *nstime);
|
||||||
|
|
||||||
|
/* is the given nstime_t currently (0,maxint)? */
|
||||||
|
extern gboolean nstime_is_unset(nstime_t *nstime);
|
||||||
|
|
||||||
/* calculate the delta between two times (can be negative!)
|
/* calculate the delta between two times (can be negative!)
|
||||||
*
|
*
|
||||||
* delta = b-a
|
* delta = b-a
|
||||||
|
|
12
file.c
12
file.c
|
@ -252,8 +252,8 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
|
||||||
} else
|
} else
|
||||||
cf->has_snap = TRUE;
|
cf->has_snap = TRUE;
|
||||||
nstime_set_zero(&cf->elapsed_time);
|
nstime_set_zero(&cf->elapsed_time);
|
||||||
nstime_set_zero(&first_ts);
|
nstime_set_unset(&first_ts);
|
||||||
nstime_set_zero(&prev_dis_ts);
|
nstime_set_unset(&prev_dis_ts);
|
||||||
|
|
||||||
cf->plist_chunk = g_mem_chunk_new("frame_data_chunk",
|
cf->plist_chunk = g_mem_chunk_new("frame_data_chunk",
|
||||||
sizeof(frame_data),
|
sizeof(frame_data),
|
||||||
|
@ -895,7 +895,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
||||||
/* If we don't have the time stamp of the first packet in the
|
/* 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
|
capture, it's because this is the first packet. Save the time
|
||||||
stamp of this packet as the time stamp of the first packet. */
|
stamp of this packet as the time stamp of the first packet. */
|
||||||
if (nstime_is_zero(&first_ts)) {
|
if (nstime_is_unset(&first_ts)) {
|
||||||
first_ts = fdata->abs_ts;
|
first_ts = fdata->abs_ts;
|
||||||
}
|
}
|
||||||
/* if this frames is marked as a reference time frame, reset
|
/* if this frames is marked as a reference time frame, reset
|
||||||
|
@ -908,7 +908,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
||||||
it's because this is the first displayed packet. Save the time
|
it's because this is the first displayed packet. Save the time
|
||||||
stamp of this packet as the time stamp of the previous displayed
|
stamp of this packet as the time stamp of the previous displayed
|
||||||
packet. */
|
packet. */
|
||||||
if (nstime_is_zero(&prev_dis_ts)) {
|
if (nstime_is_unset(&prev_dis_ts)) {
|
||||||
prev_dis_ts = fdata->abs_ts;
|
prev_dis_ts = fdata->abs_ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1500,8 +1500,8 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
|
||||||
/* Iterate through the list of frames. Call a routine for each frame
|
/* Iterate through the list of frames. Call a routine for each frame
|
||||||
to check whether it should be displayed and, if so, add it to
|
to check whether it should be displayed and, if so, add it to
|
||||||
the display list. */
|
the display list. */
|
||||||
nstime_set_zero(&first_ts);
|
nstime_set_unset(&first_ts);
|
||||||
nstime_set_zero(&prev_dis_ts);
|
nstime_set_unset(&prev_dis_ts);
|
||||||
|
|
||||||
/* Update the progress bar when it gets to this value. */
|
/* Update the progress bar when it gets to this value. */
|
||||||
progbar_nextstep = 0;
|
progbar_nextstep = 0;
|
||||||
|
|
12
tshark.c
12
tshark.c
|
@ -2282,7 +2282,7 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
|
||||||
/* If we don't have the time stamp of the first packet in the
|
/* 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
|
capture, it's because this is the first packet. Save the time
|
||||||
stamp of this packet as the time stamp of the first packet. */
|
stamp of this packet as the time stamp of the first packet. */
|
||||||
if (nstime_is_zero(&first_ts)) {
|
if (nstime_is_unset(&first_ts)) {
|
||||||
first_ts = fdata->abs_ts;
|
first_ts = fdata->abs_ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2290,7 +2290,7 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
|
||||||
it's because this is the first packet. Save the time
|
it's because this is the first packet. Save the time
|
||||||
stamp of this packet as the time stamp of the previous captured
|
stamp of this packet as the time stamp of the previous captured
|
||||||
packet. */
|
packet. */
|
||||||
if (nstime_is_zero(&prev_cap_ts)) {
|
if (nstime_is_unset(&prev_cap_ts)) {
|
||||||
prev_cap_ts = fdata->abs_ts;
|
prev_cap_ts = fdata->abs_ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2307,7 +2307,7 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
|
||||||
|
|
||||||
/* Get the time elapsed between the previous displayed packet and
|
/* Get the time elapsed between the previous displayed packet and
|
||||||
this packet. */
|
this packet. */
|
||||||
if (nstime_is_zero(&prev_dis_ts))
|
if (nstime_is_unset(&prev_dis_ts))
|
||||||
nstime_set_zero(&fdata->del_dis_ts);
|
nstime_set_zero(&fdata->del_dis_ts);
|
||||||
else
|
else
|
||||||
nstime_delta(&fdata->del_dis_ts, &fdata->abs_ts, &prev_dis_ts);
|
nstime_delta(&fdata->del_dis_ts, &fdata->abs_ts, &prev_dis_ts);
|
||||||
|
@ -3033,9 +3033,9 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
|
||||||
} else
|
} else
|
||||||
cf->has_snap = TRUE;
|
cf->has_snap = TRUE;
|
||||||
nstime_set_zero(&cf->elapsed_time);
|
nstime_set_zero(&cf->elapsed_time);
|
||||||
nstime_set_zero(&first_ts);
|
nstime_set_unset(&first_ts);
|
||||||
nstime_set_zero(&prev_dis_ts);
|
nstime_set_unset(&prev_dis_ts);
|
||||||
nstime_set_zero(&prev_cap_ts);
|
nstime_set_unset(&prev_cap_ts);
|
||||||
|
|
||||||
return CF_OK;
|
return CF_OK;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue