Thread Tag und Zeit verarbeiten
(4 answers)
Opened by chmod777 at 2019-12-21 18:32
So vielleicht. Aber ich hoffe, Du steuerst damit kein Atomkraftwerk:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 #!/usr/bin/perl use warnings; use strict; sub checkRun { my @localtime = localtime(time()); my $wday = $localtime[6]; my $hour = $localtime[2]; # Monday to Thursday: if ($wday >= 1 && $wday <= 4) { return 1; } # Saturday: if ($wday == 6) { return 0; } # Sunday: if ($wday == 0) { if ($hour < 8) { return 0; } else { return 1; } } # Friday: if ($wday == 5) { if ($hour < 16) { return 1; } else { return 0; } } } print checkRun() . "\n"; |