Make editcap -B work like expected: output no packets after the stop time.
authorSake Blok <sake@euronet.nl>
Tue, 16 Nov 2010 20:22:20 +0000 (20:22 -0000)
committerSake Blok <sake@euronet.nl>
Tue, 16 Nov 2010 20:22:20 +0000 (20:22 -0000)
Old behavior was to include a packet with a timestamp of 12:00:00.934 if -B "YYYY-MM-DD 12:00:00" was used.

svn path=/trunk/; revision=34913

doc/editcap.pod
editcap.c

index 7dd588659242b0f823e3313d645637c3da2dcdd2..7101ea7d005613d3fe1d0286d55479ec05d81c91 100644 (file)
@@ -155,7 +155,7 @@ The time is given in the following format YYYY-MM-DD HH:MM:SS
 
 =item -B  E<lt>stop timeE<gt>
 
-Saves only the packets whose timestamp is on or before stop time.
+Saves only the packets whose timestamp is before stop time.
 The time is given in the following format YYYY-MM-DD HH:MM:SS
 
 =item -h
index 7c027490a943dd8e4aed1a51b807012757bc52a7..de8af7521132ebd7691f044fa2e2aeaaef15a182 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -294,7 +294,7 @@ check_timestamp(wtap *wth)
 {
   struct wtap_pkthdr* pkthdr = wtap_phdr(wth);
 
-  return ( pkthdr->ts.secs >= starttime ) && ( pkthdr->ts.secs <= stoptime );
+  return ( pkthdr->ts.secs >= starttime ) && ( pkthdr->ts.secs < stoptime );
 }
 
 static void
@@ -674,9 +674,9 @@ usage(gboolean is_error)
   fprintf(output, "\n");
   fprintf(output, "Packet selection:\n");
   fprintf(output, "  -r                     keep the selected packets; default is to delete them.\n");
-  fprintf(output, "  -A <start time>        don't output packets whose timestamp is before the\n");
-  fprintf(output, "                         given time (format as YYYY-MM-DD hh:mm:ss).\n");
-  fprintf(output, "  -B <stop time>         don't output packets whose timestamp is after the\n");
+  fprintf(output, "  -A <start time>        only output packets whose timestamp is after (or equal\n");
+  fprintf(output, "                         to) the given time (format as YYYY-MM-DD hh:mm:ss).\n");
+  fprintf(output, "  -B <stop time>         only output packets whose timestamp is before the\n");
   fprintf(output, "                         given time (format as YYYY-MM-DD hh:mm:ss).\n");
   fprintf(output, "\n");
   fprintf(output, "Duplicate packet removal:\n");