use IO::File;
use DXDebug;
use Data::Dumper;
+use Time::HiRes qw(gettimeofday tv_interval);
use strict;
$fp = DXLog::new('wcy', 'dat', 'm');
do "$param" if -e "$param";
# read in existing data
+ my $t0 = [gettimeofday];
@cache = readfile($main::systime);
shift @cache while @cache > $maxcache;
- dbg(sprintf "WCY read in last %d records into cache", scalar @cache);
+ dbg(sprintf "WCY read in last %d records into cache %dmS", scalar @cache, _diffms($t0));
confess $@ if $@;
}
my $count;
my $i;
- if ($t == $main::systime && ($to <= $maxcache)) {
+ if ($t == $main::systime && ($to && $to <= @cache)) {
dbg("using wcy cache") if isdbg('wcy');
@out = reverse @cache;
pop @out while @out > $to;
my $d = cldate($r->[0]);
my $t = (gmtime($r->[0]))[2];
- return sprintf("$d %02d %5d %3d %3d %3d %3d %-5s %-5s %6s <%s>",
+ return sprintf("$d %02d %5d %3d %3d %3d %3d %-5s %-5s %6s <%s>",
$t, @$r[1..9]);
}