aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2020-05-04 14:27:58 -0700
committerGuy Harris <gharris@sonic.net>2020-05-04 21:49:04 +0000
commit432cb2070718cd5d3aa2e485a91d8a8d32485e10 (patch)
tree6d1a290e30bc9d1f21f926a85f1f93a5d6d4d5ec
parent274ec6adc4983008fc0b500aa28594d99649e474 (diff)
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>
-rw-r--r--epan/dissectors/file-pcapng.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/file-pcapng.c b/epan/dissectors/file-pcapng.c
index 6353a1dc7c..1792047de9 100644
--- a/epan/dissectors/file-pcapng.c
+++ b/epan/dissectors/file-pcapng.c
@@ -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);