Earindil has asked for the wisdom of the Perl Monks concerning the following question:
This is what I was getting when I tried to avoid using Datecalc and instead used the $i variable and multiplied it by the # of seconds to skip... As you can see, it worked for a bit but then started drifting more and more...my @data = split(/\,/,$Client{$client}{$cmd}); my $time = $data[0]; for ($i=3; $i<=$#data; $i++) { $seconds = &UnixDate("$time","%s"); if ($cmd eq 'RTT') { $time = &DateCalc("$time","+ 1minute",\$err); $value = sprintf("%0.2f", ($data[$i]/1000)); } else { $time = &DateCalc("$time","+ 30seconds",\$err +); $value = sprintf("%0.2f", (($data[$i]*8)/1000) +); # Convert to bits then / by 1000 for graphing } $seconds = (int($seconds/300))*300; $Counter{$seconds}++; $Tot{$seconds}+=$value; $Max{$seconds}=$value if ($value>$Max{$seconds}); $Min{$seconds}=$value if (($value<$Min{$seconds})or(!$ +Min{$seconds})); }
04/28/05.07:15:00 0.03 0.03 0.03 04/28/05.07:20:00 0.03 0.03 0.03 04/28/05.07:25:00 0.03 0.03 0.03 04/28/05.07:30:00 0.03 0.03 0.03 04/28/05.07:35:00 0.03 0.03 0.03 04/28/05.07:40:00 0.03 0.03 0.03 04/28/05.07:50:00 0.03 0.03 0.03 04/28/05.08:00:00 0.05 0.05 0.05 04/28/05.08:10:00 0.03 0.03 0.03 04/28/05.08:20:00 0.03 0.03 0.03 04/28/05.08:30:00 0.03 0.03 0.03 04/28/05.08:45:00 0.03 0.03 0.03 04/28/05.09:00:00 0.03 0.03 0.03 04/28/05.09:15:00 0.03 0.03 0.03 04/28/05.09:30:00 0.03 0.03 0.03 04/28/05.09:45:00 0.03 0.03 0.03 04/28/05.10:05:00 0.03 0.03 0.03 04/28/05.10:25:00 0.03 0.03 0.03 04/28/05.10:45:00 0.03 0.03 0.03 . . .This is all necessary because the original data looks like this. Time, interval, # of elements, then results
07:30:04,60,750,32058,41,98,41,41,98,43,41,73,98,18050,467,428,260,363 +,836,258,1499,247,489,1208,469,633,749,439,342,258,706,817,639 ,2174,848,909,557,876,1633,1116,1090,665,1150,817,1592,791,1741,935,67 +5,2370,2039,2121,911,1955,1526,608,656,375,1488,529,376,268,10 82,1858,2036,1282,859,1356,1654,1620,2074,1546,488,2999,1564,1509,811, +1427,2149,611,1548,803,2313,1823,1575,1733,1168,2511,1034,2090 ,1491,2361,2663,2062,1455,957,3549,3097,2443,2680,2262,2152,2176,2645, +3029,2078,1395,1961,801,1955,1395,1465,1030,976,1026,813,932,1 745,450,1172,1457,.....
Janitored by Arunbear - added code tags, to prevent distortion of site layout
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Avoiding Datecalc
by tlm (Prior) on Apr 28, 2005 at 21:32 UTC | |
|
Re: Avoiding Datecalc
by 5mi11er (Deacon) on Apr 28, 2005 at 20:57 UTC | |
|
Re: Avoiding Datecalc
by Earindil (Beadle) on Apr 29, 2005 at 15:10 UTC |