Conal has asked for the wisdom of the Perl Monks concerning the following question:
desired pair - 1.29132 ,01:59:59//SNAGIT.TXT eg top of the hour 1.29133 ,01:59:34 1.29132 ,01:59:59 1.29132 ,01:59:59 .....
desired pair - 1.29020 ,01:29:52//SNAGIT.TXT e.g bottom of the hour 1.29020 ,01:29:52 1.29036 ,01:30:02 1.29035 ,01:30:12 ....
Now my problem is; The code works great when the script runs on the 30minute, $actualquote gets assigned as it should.use Time::ParseDate; use Time::Local; ... my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdist) = localtime +time; my $month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(lo +caltime)[4]]; my $day = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime)[6]]; $year = $year+1900; my $input = "SNAGIT.txt"; my $actualquote1=0; ## Open the SNAGIT.TXT, plus some sensible error checking open(DATAFILE, "$input") || die("Can't open $input:!\n"); ## Loop through the file one line at a time while (<DATAFILE>) { chomp; if ( m{^ (\d\.\d{5}) \s*,\s* (\d\d:\d\d:\d\d) \s* (.*) $ }x ) ## 1.XXXXX { my ( $quote, $linetime, $comment ) = ( $1, $2, $3 ); # captures my ( $snaghour, $snagminute, $snagsecond ) = split /:/, $linetime; + chop($quote); if (parsedate($snaghour.":".$snagminute.":".$snagsecond) <= parsed +ate($hour.":".$min.":00")) { $actualquote1 = $quote; } } } close(DATAFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Time::ParseDate issues
by eye (Chaplain) on Nov 27, 2008 at 07:06 UTC | |
by spmlingam (Scribe) on Nov 27, 2008 at 11:24 UTC | |
by Conal (Beadle) on Nov 28, 2008 at 13:39 UTC | |
by Cristoforo (Curate) on Nov 29, 2008 at 02:09 UTC | |
by Conal (Beadle) on Nov 29, 2008 at 07:14 UTC | |
|
Re: Time::ParseDate issues
by Anonymous Monk on Nov 27, 2008 at 03:31 UTC |