aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/netmon.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 /wiretap/netmon.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 'wiretap/netmon.c')
-rw-r--r--wiretap/netmon.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index bc10056510..c3c552d2d0 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -452,8 +452,8 @@ static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
}
secs = (time_t)(t/1000000);
usecs = (guint32)(t - (double)secs*1000000);
- wth->phdr.ts.tv_sec = netmon->start_secs + secs;
- wth->phdr.ts.tv_usec = usecs;
+ wth->phdr.ts.secs = netmon->start_secs + secs;
+ wth->phdr.ts.nsecs = usecs * 1000;
wth->phdr.caplen = packet_size;
wth->phdr.len = orig_size;
@@ -681,8 +681,8 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
case WTAP_FILE_NETMON_1_x:
rec_1_x_hdr.ts_delta = htolel(
- (phdr->ts.tv_sec - netmon->first_record_time.tv_sec)*1000
- + (phdr->ts.tv_usec - netmon->first_record_time.tv_usec + 500)/1000);
+ (phdr->ts.secs - netmon->first_record_time.secs)*1000
+ + (phdr->ts.nsecs - netmon->first_record_time.nsecs + 500000)/1000000);
rec_1_x_hdr.orig_len = htoles(phdr->len + atm_hdrsize);
rec_1_x_hdr.incl_len = htoles(phdr->caplen + atm_hdrsize);
hdrp = (char *)&rec_1_x_hdr;
@@ -696,8 +696,8 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
* (even on 32-bit processors), so we do it in floating
* point.
*/
- t = (phdr->ts.tv_sec - netmon->first_record_time.tv_sec)*1000000.0
- + (phdr->ts.tv_usec - netmon->first_record_time.tv_usec);
+ t = (phdr->ts.secs - netmon->first_record_time.secs)*1000000.0
+ + (phdr->ts.nsecs - netmon->first_record_time.nsecs) / 1000;
time_high = (guint32) (t/4294967296.0);
time_low = (guint32) (t - (time_high*4294967296.0));
rec_2_x_hdr.ts_delta_lo = htolel(time_low);
@@ -848,7 +848,7 @@ static gboolean netmon_dump_close(wtap_dumper *wdh, int *err)
}
file_hdr.network = htoles(wtap_encap[wdh->encap]);
- tm = localtime(&netmon->first_record_time.tv_sec);
+ tm = localtime(&netmon->first_record_time.secs);
if (tm != NULL) {
file_hdr.ts_year = htoles(1900 + tm->tm_year);
file_hdr.ts_month = htoles(tm->tm_mon + 1);
@@ -866,7 +866,7 @@ static gboolean netmon_dump_close(wtap_dumper *wdh, int *err)
file_hdr.ts_min = htoles(0);
file_hdr.ts_sec = htoles(0);
}
- file_hdr.ts_msec = htoles(netmon->first_record_time.tv_usec/1000);
+ file_hdr.ts_msec = htoles(netmon->first_record_time.nsecs/1000000);
/* XXX - what about rounding? */
file_hdr.frametableoffset = htolel(netmon->frame_table_offset);
file_hdr.frametablelength =