in reply to Re: Time::ParseDate issues
in thread Time::ParseDate issues

hi eye, thanks for replying with this. i have tried a number of solutions here and yours seems the most likely. fixing up $hour and $min so it is in a format that doesnt make Parsedate return undef still produces an issue at 00:00:00. i have a problem tho, what is this code doing exactly and why does it work?
my $now = time; $now -= ($now % 60);
and also would it work if i wanted to run my code every 5minutes with similar data, as opposed to 30minutes? thanks for your input and sorry to be a pain.
conal.

Replies are listed 'Best First'.
Re^3: Time::ParseDate issues
by Cristoforo (Curate) on Nov 29, 2008 at 02:09 UTC
    parsedate($hour.":".$min.":00"))

    should give the same number of seconds,(since Jan 1, 1970), as:

    my $now = time; $now -= ($now % 60);

    I say should because I don't know if the function parsedate gives seconds since the epoch when only supplied the time numbers (and not the date numbers).

    What his code is doing is removing any seconds (> 00)

    Chris

      Yes Time::ParseDate does resolve to the number of seconds since jan 1 1970, even if only hours and minutes and seconds are sent to the function.

      'The return code is always the time in seconds since January 1st, 1970 or undef if it was unable to parse the time.'

      http://search.cpan.org/~muir/Time-modules-2003.0211/lib/Time/ParseDate.pm#DESCRIPTION

      I believe thats it pretty much sussed now. thanks everyone ever so much. its much appreciated.
      conal.