Hallo,ich habe ein Logikproblem und hänge damit schon den ganzen Morgen fest. Ich möchte mit Perl feststellen, ob sich eine Uhrzeit (Stunde) in einem gewissen Rahmen befindet. Dieser wird vorgegeben durch "VON (h)" - "BIS (h)". Soweit so gut...
Mein Problem ist jetzt, wenn die "VON" zeit grösser ist als die "BIS" zeit. Wie kann ich das fesststellen?
hat jemand eine Idee...
ID VON (h) BIS (h)
1 7 22
2 6 1
3 9 17
4 7 22
5 6 0
das hab ich bis jetzt hinbekommen, aber z.b. bei id 2 stimmt es nicht.
sub UeberpruefeZeitrahmen () {
my ($pSelf) = @_;
my $pZeit = 8;
if ( $pSelf->{'ZEIT_VON'} < $pSelf->{'ZEIT_BIS'} ) {
( $pZeit >= $pSelf->{'ZEIT_VON'} && $pZeit < $pSelf->{'ZEIT_BIS'} ) ? return 1 : return 0;
} else {
if ( $pSelf->{'ZEIT_BIS'} == 0 ) {
$pSelf->{'ZEIT_BIS'} = 24;
( $pZeit >= $pSelf->{'ZEIT_VON'} && $pZeit < $pSelf->{'ZEIT_BIS'} ) ? return 1 : return 0;
} else {
( $pZeit < $pSelf->{'ZEIT_VON'} && $pZeit >= $pSelf->{'ZEIT_BIS'} ) ? return 1 : return 0;
}
}
}
danke für eure bemühungen.
mfg
Datum: 06.12.2005-08:42
