-start-
> "Dennis Smith" <[EMAIL PROTECTED]>
>at 04/12/2001 10:36 AM
>How do I compare a timestamp using a logical operator >?
>here is the problem I want to find any errors in my log from the last
hour.
>The log file has a timestamp with the local time format.
>Wed Apr 11 22:05:09 2001
>localtime(time-360)<'Wed Apr 11 22:05:09 2001'
>How can I make the string Wed Apr 11 22:05:09 2001 into a localtime
object that I can use for comparisons.
Parse the date string and convert it into epoch seconds. time() returns
the system time in seconds since epoch.
use Date::Manip;
$main::TZ = 'CST';
my $stamp = 'Wed Apr 11 22:05:09 2001';
my $prev = time-360; # no need for localtime
if ($prev < UnixDate($stamp,"%s")) { print "ok\n"; }
Grant Hopwood.
Valero Energy Corp.
(210)370-2380
PGP Public Key: Ldap://certserver.pgp.com
nuclear iraq bioweapon encryption cocaine korea terrorist
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users