The Date::Calc module's Date_to_Time will convert your date/time information almost directly, with the addition of a trailing 0 for seconds. Given this, and your task, perhaps the following will assist your coding:
use Modern::Perl;
use Date::Calc qw/Date_to_Time/;
my $duration = 10 * 60;
my $fileName = 'data.txt';
open my $fh, '<', $fileName or die "Unable to open file: $!";
for ( ; ; ) {
my ( $first, @lines );
while ( my $line = <$fh> ) {
my ( $date, $time, $values ) = split ',', $line, 3;
my @dateTime = "$date $time 0" =~ /(\d+)/g;
my $timeInSecs = Date_to_Time @dateTime;
$first = $timeInSecs unless $first;
push @lines, "$timeInSecs\t$values";
last if $timeInSecs - $first >= $duration;
}
# Start work with chunk of lines in array
#
do { /(\S+)\t(\S+)/; say "Seconds: $1; Values: $2" }
for @lines;
say '----------';
#
# End work with chunk of lines in array
last if eof $fh;
}
close $fh;
Output (lines were added to your original data set):
Seconds: 1294953900; Values: 1.33508,1.33524,1.33470,1.33494,391
Seconds: 1294954020; Values: 1.33508,1.33524,1.33470,1.33494,391
Seconds: 1294954200; Values: 1.33494,1.33506,1.33447,1.33453,318
Seconds: 1294954320; Values: 1.33494,1.33506,1.33447,1.33453,318
Seconds: 1294954500; Values: 1.33453,1.33483,1.33417,1.33434,426
----------
Seconds: 1294954620; Values: 1.33453,1.33483,1.33417,1.33434,426
Seconds: 1294954800; Values: 1.33434,1.33468,1.33417,1.33467,309
Seconds: 1294954920; Values: 1.33434,1.33468,1.33417,1.33467,309
Seconds: 1294955100; Values: 1.33471,1.33493,1.33465,1.33465,233
Seconds: 1294955220; Values: 1.33434,1.33468,1.33417,1.33467,309
----------
Seconds: 1294955400; Values: 1.33465,1.33475,1.33443,1.33463,184
Seconds: 1294955520; Values: 1.33465,1.33475,1.33443,1.33463,184
Seconds: 1294955700; Values: 1.33463,1.33519,1.33463,1.33493,344
Seconds: 1294955820; Values: 1.33465,1.33475,1.33443,1.33463,184
Seconds: 1294956000; Values: 1.33494,1.33563,1.33489,1.33524,318
----------
Seconds: 1294956120; Values: 1.33494,1.33563,1.33489,1.33524,318
Seconds: 1294956300; Values: 1.33524,1.33551,1.33512,1.33549,182
----------
The script will read in N lines from a data file, based upon the value of $duration, which, in this case, is set to 10 minutes (always set $duration to seconds). The output shows clusters of lines within 10 minute intervals. The routine may grab one line beyond the duration, but hopefully that data granularity is sufficient for your analysis.
Not knowing how you want to work with your data, the push @lines, "$timeInSecs\t$values"; line can be changed to push only the raw lines (or whatever you may need) onto the array @lines.
Hope this helps!