in reply to Run code every 6seconde
Assuming that FONCTION1 and FONCTION2 will reliably execute in less than 6 seconds, and that exact timing is not critical:
my $did_this_time = 0; while (1) { my $now = time; if ( $now != $did_this_time && $now % 6 == 0 ) { $did_this_time = $now; FONCTION1(); FONCTION2(); } }
update: forgot to mention that this will keep the CPU rather busy... Adding a sleep 1; to the loop will help with that.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Run code every 6seconde
by JavaFan (Canon) on Dec 05, 2011 at 15:56 UTC | |
Re^2: Run code every 6seconde
by Anonymous Monk on Dec 05, 2011 at 15:43 UTC |
In Section
Seekers of Perl Wisdom