Re: How to see if a time is within two other times.
- From: "A. Sinan Unur" <1usa@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 20:31:51 GMT
"Ninja67" <Ninja67@xxxxxxxxx> wrote in
news:1120074745.373483.169390@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:
> I need to modify a script in such a way that it checks the current
> time (according to the server) to determine if the current time falls
> within a particular time span such as midnight to 4:00 am.
Time::Local can help:
#!/usr/bin/perl
use strict;
use warnings;
use Time::Local;
# 2005/06/29 16:00:00
my $start = timelocal(0, 0, 16, 29, 5, 2005);
my $end = $start + (4 * 60 * 60);
if($start <= time and time <= $end) {
run();
} else {
expired();
}
sub run { print "Running\n" }
sub expired { print "Expired\n" }
__END__
Sinan
--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
.
- Follow-Ups:
- Re: How to see if a time is within two other times.
- From: A. Sinan Unur
- Re: How to see if a time is within two other times.
- From: Ninja67
- Re: How to see if a time is within two other times.
- References:
- How to see if a time is within two other times.
- From: Ninja67
- How to see if a time is within two other times.
- Prev by Date: Re: How to see if a time is within two other times.
- Next by Date: Re: How to see if a time is within two other times.
- Previous by thread: Re: How to see if a time is within two other times.
- Next by thread: Re: How to see if a time is within two other times.
- Index(es):
Relevant Pages
|
|