From e51a8d4f1b18f379415a4ec1d6144da104c4bda6 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Thu, 24 Jul 2014 12:26:30 -0400 Subject: [PATCH] [scripts] AggCheck: detect duplicated timestamps owlps-aggcheck uses the timestamp alone to identify requests, which causes problem in case two requests have the same timestamp. This commit allows the script to detect duplicated timestamps, and documents the bug. --- scripts/owlps-aggcheck.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/owlps-aggcheck.pl b/scripts/owlps-aggcheck.pl index d4998bd..a71f9c0 100755 --- a/scripts/owlps-aggcheck.pl +++ b/scripts/owlps-aggcheck.pl @@ -58,6 +58,16 @@ behaviour unless B<-d> or B<-n> is used). =back +=head1 BUGS + +When using B<-n> or B<-d>, each timestamp must be unique in the input file. This +is due to the fact that this script uses the timestamp alone as the identifier +of a request (instead of using both the timestamp and the transmitter's MAC +address). This should seldom be a problem in practice, but if you encounter +this case, a workaround is to manually add a decimal to one of the duplicated +timestamps. + + =head1 COPYING This script and its documentation are part of the Owl Positioning System (OwlPS) @@ -219,6 +229,15 @@ while (<>) { . " ($nb_pkts_expected packets expected).\n"; } + # Make sure we don't have a request with the same timestamp already, because + # it will be a problem if we want to print the statistics or the + # distribution + if (($print_stats or $print_distribution) and $transmitters{$timestamp}) { + die "A request with timestamp \"$timestamp\" was already stored;" + . " this program doesn't work properly with non-unique timestamps" + . " (see section \"BUGS\" in the manual page)."; + } + # Read the captured requests and count the packets while ($field_nb < @fields) { my $mac_cp = $fields[$field_nb];