diff options
author | Stephen Fisher <steve@stephen-fisher.com> | 2008-02-20 04:41:31 +0000 |
---|---|---|
committer | Stephen Fisher <steve@stephen-fisher.com> | 2008-02-20 04:41:31 +0000 |
commit | 831d85448abd146aba19eb56cf8af25dfc478c79 (patch) | |
tree | 1bcb93b18f0b77ea5335a3aebcfe39839d11e770 /wiretap | |
parent | 9bd9942aababe2a53431da5407c5bcaa86d73db4 (diff) | |
download | wireshark-831d85448abd146aba19eb56cf8af25dfc478c79.tar.gz wireshark-831d85448abd146aba19eb56cf8af25dfc478c79.tar.bz2 wireshark-831d85448abd146aba19eb56cf8af25dfc478c79.zip |
Really fix pcapng timestamp reading and writing this time.
svn path=/trunk/; revision=24398
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/pcapng.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index bb100605a4..aeb4a54712 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -1032,7 +1032,7 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, case(WTAP_FILE_TSPREC_USEC): wth->phdr.ts.secs = (time_t) (ts / 1000000); - wth->phdr.ts.nsecs = (int) (ts % 1000000); + wth->phdr.ts.nsecs = (int) (ts % 1000000) * 1000; break; case(WTAP_FILE_TSPREC_NSEC): wth->phdr.ts.secs = (time_t) (ts / 1000000000); @@ -1321,7 +1321,7 @@ static gboolean pcapng_dump(wtap_dumper *wdh, const guchar *pd, int *err) { wtapng_block_t wblock; - guint64 ts = 0; + guint64 ts; wblock.frame_buffer = pd; wblock.pseudo_header = pseudo_header; @@ -1329,20 +1329,11 @@ static gboolean pcapng_dump(wtap_dumper *wdh, /* write the (enhanced) packet block */ wblock.type = BLOCK_TYPE_EPB; - switch(wdh->tsprecision) { - - case(WTAP_FILE_TSPREC_USEC): - ts = (phdr->ts.secs * 1000000) + (phdr->ts.nsecs / 1000); - break; - case(WTAP_FILE_TSPREC_NSEC): - ts = (phdr->ts.secs * 1000000000) + phdr->ts.nsecs; - break; - default: - pcapng_debug1("pcapng_dump: if_tsresol %u not implemented, timestamp conversion omitted", wdh->tsprecision); - } + /* default is to write out in microsecond resolution */ + ts = (((guint64)phdr->ts.secs) * 1000000) + (phdr->ts.nsecs / 1000); /* Split the 64-bit timestamp into two 32-bit pieces */ - wblock.data.packet.ts_high = (guint32)(ts << 32); + wblock.data.packet.ts_high = (guint32)(ts >> 32); wblock.data.packet.ts_low = (guint32)ts; wblock.data.packet.cap_len = phdr->caplen; |