aboutsummaryrefslogtreecommitdiffstats
path: root/tethereal.c
diff options
context:
space:
mode:
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>2005-08-24 21:31:56 +0000
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>2005-08-24 21:31:56 +0000
commite7e62591fe23566d2bb5685ade31d2a925ed726c (patch)
tree7be99a00405385c14e1606c31906463d60107655 /tethereal.c
parent6f063a4571dad2e3d8681d4ce6b1114bcc1b811b (diff)
EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry!
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ... What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere. As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon. Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way... As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number... git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15520 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tethereal.c')
-rw-r--r--tethereal.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/tethereal.c b/tethereal.c
index 9f1324a329..65f933cd81 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -106,8 +106,8 @@
*/
static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_as_protocol>";
-static guint32 firstsec, firstusec;
-static guint32 prevsec, prevusec;
+static nstime_t first_ts;
+static nstime_t prev_ts;
static GString *comp_info_str, *runtime_info_str;
static gboolean print_packet_info; /* TRUE if we're to print packet information */
@@ -2225,8 +2225,7 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
fdata->cap_len = phdr->caplen;
fdata->file_off = offset;
fdata->lnk_t = phdr->pkt_encap;
- fdata->abs_secs = phdr->ts.tv_sec;
- fdata->abs_usecs = phdr->ts.tv_usec;
+ fdata->abs_ts = *((nstime_t *) &phdr->ts);
fdata->flags.passed_dfilter = 0;
fdata->flags.encoding = CHAR_ASCII;
fdata->flags.visited = 0;
@@ -2236,39 +2235,33 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
/* 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
stamp of this packet as the time stamp of the first packet. */
- if (!firstsec && !firstusec) {
- firstsec = fdata->abs_secs;
- firstusec = fdata->abs_usecs;
+ if (nstime_is_zero(&first_ts)) {
+ 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
packet. */
- if (!prevsec && !prevusec) {
- prevsec = fdata->abs_secs;
- prevusec = fdata->abs_usecs;
+ if (nstime_is_zero(&prev_ts)) {
+ prev_ts = fdata->abs_ts;
}
/* Get the time elapsed between the first packet and this packet. */
- compute_timestamp_diff(&fdata->rel_secs, &fdata->rel_usecs,
- fdata->abs_secs, fdata->abs_usecs, firstsec, firstusec);
+ nstime_delta(&fdata->rel_ts, &fdata->abs_ts, &first_ts);
/* If it's greater than the current elapsed time, set the elapsed time
to it (we check for "greater than" so as not to be confused by
time moving backwards). */
- if ((gint32)cf->esec < fdata->rel_secs
- || ((gint32)cf->esec == fdata->rel_secs && (gint32)cf->eusec < fdata->rel_usecs)) {
- cf->esec = fdata->rel_secs;
- cf->eusec = fdata->rel_usecs;
+ if ((gint32)cf->elapsed_time.secs < fdata->rel_ts.secs
+ || ((gint32)cf->elapsed_time.secs == fdata->rel_ts.secs && (gint32)cf->elapsed_time.nsecs < fdata->rel_ts.nsecs)) {
+ cf->elapsed_time = fdata->rel_ts;
}
/* Get the time elapsed between the previous displayed packet and
this packet. */
- compute_timestamp_diff(&fdata->del_secs, &fdata->del_usecs,
- fdata->abs_secs, fdata->abs_usecs, prevsec, prevusec);
- prevsec = fdata->abs_secs;
- prevusec = fdata->abs_usecs;
+ nstime_delta(&fdata->del_ts, &fdata->abs_ts, &prev_ts);
+ prev_ts = fdata->abs_ts;
}
/* Free up all data attached to a "frame_data" structure. */
@@ -2987,8 +2980,6 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
cf->count = 0;
cf->drops_known = FALSE;
cf->drops = 0;
- cf->esec = 0;
- cf->eusec = 0;
cf->snap = wtap_snapshot_length(cf->wth);
if (cf->snap == 0) {
/* Snapshot length not known. */
@@ -2996,8 +2987,9 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
cf->snap = WTAP_MAX_PACKET_SIZE;
} else
cf->has_snap = TRUE;
- firstsec = 0, firstusec = 0;
- prevsec = 0, prevusec = 0;
+ nstime_set_zero(&cf->elapsed_time);
+ nstime_set_zero(&first_ts);
+ nstime_set_zero(&prev_ts);
return CF_OK;