in reply to Perl Cron Daemon
The code below will print "Event @ $sec" if the time is either :00 or :01. I don't know how taxing it is on the computer. I think that sleep does an alarm + pause call so it shouldn't be spin waiting. The reason for the sleep(30); is so that there is an additional time to correct for error due to sleep(.).
while(1) { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( +); if($sec > 1) { sleep(60-$sec); } else { print "Event @ $sec\n"; sleep(30); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Cron Daemon
by perlAffen (Sexton) on Jun 02, 2011 at 15:35 UTC |