Fix calculation of fractional part of time stamps.

Do it the same way that wiretap/pcapng.c does it.

Bug: 16440
Change-Id: Ied811e5d10d4219de718f4f74254440b324f0ed1
Reviewed-on: https://code.wireshark.org/review/37132
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
This commit is contained in:
Guy Harris 2020-05-04 14:27:58 -07:00 committed by Guy Harris
parent 274ec6adc4
commit 432cb20707
1 changed files with 1 additions and 1 deletions

View File

@ -1245,7 +1245,7 @@ pcapng_add_timestamp(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
pinfo->presence_flags &= ~PINFO_HAS_TS;
} else {
timestamp.secs = (time_t)(ts / interface_description->timestamp_resolution);
timestamp.nsecs = (int)(ts - (ts / interface_description->timestamp_resolution) * interface_description->timestamp_resolution);
timestamp.nsecs = (int)(((ts % interface_description->timestamp_resolution) * 1000000000) / interface_description->timestamp_resolution);
ti = proto_tree_add_time(tree, hf_pcapng_timestamp, tvb, offset, 8, &timestamp);
proto_item_set_generated(ti);