From 74e95d8e6f87b915213899bfd5f426627ff58bbb Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sat, 19 Oct 2013 23:37:17 -0700 Subject: [PATCH] If using --timefmt then --xlen MUST have an integer argument I use strftime() and strptime() to deal with xlen in the timefmt case, and those functions only work with integers --- bin/feedgnuplot | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/feedgnuplot b/bin/feedgnuplot index aa98136..975d9e6 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -314,6 +314,17 @@ sub interpretCommandline $options{timefmt_Ncols} = $Nfields; my $regex_str = join( '\s+', ('\S+') x $Nfields ); $options{timefmt_regex} = qr/$regex_str/; + + # make sure --xlen is an integer. With a timefmt xlen goes through strptime + # and strftime, and those are integer-only + if( defined $options{xlen} ) + { + if( $options{xlen} - int($options{xlen}) ) + { + say STDERR "When streaming --xlen MUST be an integer. Rounding up to the nearest second"; + $options{xlen} = 1 + int($options{xlen}); + } + } } } @@ -1061,7 +1072,7 @@ given, some other options act a little bit differently: =item -C<--xlen> is in seconds +C<--xlen> is an I in seconds =item @@ -1103,7 +1114,7 @@ windowsize> can be given. This will create an constantly-updating, scrolling view of the recent past. C should be replaced by the desired length of the domain window to plot, in domain units (passed-in values if C<--domain> or line numbers otherwise). If the domain is a time/date via C<--timefmt>, then -C is in seconds. +C is and I in seconds. =head3 Special data commands