aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/etherpeek.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-08-26 19:40:46 +0000
committerGuy Harris <guy@alum.mit.edu>2005-08-26 19:40:46 +0000
commit98473c77b6976eabae05a806af860d645fbf0cc7 (patch)
tree68934343e3f03b0f509d3e4964f93ac45816a918 /wiretap/etherpeek.c
parent6f42e3ce750fd4c65559b2530919f8d07f4b159f (diff)
Ethereal now requires 64-bit integer support, so get rid of the tests of
G_HAVE_GINT64. Get rid of the floating-point stuff in the Etherpeek Classic file reading code, just use 64-bit integers. Fix up the calculation of the nanoseconds portion of the time stamp. svn path=/trunk/; revision=15544
Diffstat (limited to 'wiretap/etherpeek.c')
-rw-r--r--wiretap/etherpeek.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/wiretap/etherpeek.c b/wiretap/etherpeek.c
index 6aea88515b..6fc9ef1518 100644
--- a/wiretap/etherpeek.c
+++ b/wiretap/etherpeek.c
@@ -117,8 +117,7 @@ typedef struct etherpeek_utime {
#define ETHERPEEK_V7_SLICE_LENGTH_OFFSET 4
#define ETHERPEEK_V7_FLAGS_OFFSET 6
#define ETHERPEEK_V7_STATUS_OFFSET 7
-#define ETHERPEEK_V7_TIMESTAMP_UPPER_OFFSET 8
-#define ETHERPEEK_V7_TIMESTAMP_LOWER_OFFSET 12
+#define ETHERPEEK_V7_TIMESTAMP_OFFSET 8
#define ETHERPEEK_V7_PKT_SIZE 16
/*
@@ -372,8 +371,9 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
guint16 sliceLength;
guint8 flags;
guint8 status;
- etherpeek_utime timestamp;
- double t;
+ guint64 timestamp;
+ time_t tsecs;
+ guint32 tusecs;
airopeek_radio_hdr_t radio_hdr;
*data_offset = wth->data_offset;
@@ -387,8 +387,7 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
sliceLength = pntohs(&ep_pkt[ETHERPEEK_V7_SLICE_LENGTH_OFFSET]);
flags = ep_pkt[ETHERPEEK_V7_FLAGS_OFFSET];
status = ep_pkt[ETHERPEEK_V7_STATUS_OFFSET];
- timestamp.upper = pntohl(&ep_pkt[ETHERPEEK_V7_TIMESTAMP_UPPER_OFFSET]);
- timestamp.lower = pntohl(&ep_pkt[ETHERPEEK_V7_TIMESTAMP_LOWER_OFFSET]);
+ timestamp = pntohll(&ep_pkt[ETHERPEEK_V7_TIMESTAMP_OFFSET]);
/* force sliceLength to be the actual length of the packet */
if (0 == sliceLength) {
@@ -447,12 +446,10 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
wth->data_offset += sliceLength;
/* fill in packet header values */
- t = (double) timestamp.lower +
- (double) timestamp.upper * 4294967296.0;
- t -= (double) mac2unix * 1000000.0;
- wth->phdr.ts.secs = (time_t) (t/1000000.0);
- wth->phdr.ts.nsecs = (guint32) (t - (double) wth->phdr.ts.secs *
- 1000000000.0);
+ tsecs = (time_t) (timestamp/1000000);
+ tusecs = (guint32) (timestamp - tsecs*1000000);
+ wth->phdr.ts.secs = tsecs - mac2unix;
+ wth->phdr.ts.nsecs = tusecs * 1000;
if (wth->file_encap == WTAP_ENCAP_IEEE_802_11_WITH_RADIO) {
/*