mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
93_DbRep: contrib v 8.45.0
git-svn-id: https://svn.fhem.de/fhem/trunk@25305 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d72c1b62c1
commit
f58a962d80
@ -2072,15 +2072,7 @@ sub DbRep_Main {
|
||||
elsif ($opt eq "delEntries") {
|
||||
delete $hash->{HELPER}{DELENTRIES};
|
||||
if($IsTimeSet || $IsAggrSet) { # Forum:#113202
|
||||
my ($yyyy1, $mm1, $dd1, $hh1, $min1, $sec1) = $runtime_string_first =~ /(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/x;
|
||||
my ($yyyy2, $mm2, $dd2, $hh2, $min2, $sec2) = $runtime_string_next =~ /(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/x;
|
||||
my $nthants = fhemTimeLocal($sec1, $min1, $hh1, $dd1, $mm1-1, $yyyy1-1900);
|
||||
my $othants = fhemTimeLocal($sec2, $min2, $hh2, $dd2, $mm2-1, $yyyy2-1900);
|
||||
|
||||
if($nthants > $othants) {
|
||||
ReadingsSingleUpdateValue ($hash, "state", "Error - Wrong time limits. The <nn> (days newer than) option must be greater than the <no> (older than) one !", 1);
|
||||
return;
|
||||
}
|
||||
DbRep_checkValidTimeSequence ($hash, $runtime_string_first, $runtime_string_next) or return;
|
||||
}
|
||||
|
||||
$hash->{HELPER}{RUNNING_PID} = BlockingCall("del_DoParse", "$name|history|$device|$reading|$runtime_string_first|$runtime_string_next", "del_ParseDone", $to, "DbRep_ParseAborted", $hash);
|
||||
@ -2173,15 +2165,7 @@ sub DbRep_Main {
|
||||
}
|
||||
|
||||
if ($opt =~ /reduceLog/) {
|
||||
my ($yyyy1, $mm1, $dd1, $hh1, $min1, $sec1) = $runtime_string_first =~ /(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/x;
|
||||
my ($yyyy2, $mm2, $dd2, $hh2, $min2, $sec2) = $runtime_string_next =~ /(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/x;
|
||||
my $nthants = fhemTimeLocal($sec1, $min1, $hh1, $dd1, $mm1-1, $yyyy1-1900);
|
||||
my $othants = fhemTimeLocal($sec2, $min2, $hh2, $dd2, $mm2-1, $yyyy2-1900);
|
||||
|
||||
if($nthants > $othants) {
|
||||
ReadingsSingleUpdateValue ($hash, "state", "Error - Wrong time limits. The <nn> (days newer than) option must be greater than the <no> (older than) one !", 1);
|
||||
return;
|
||||
}
|
||||
DbRep_checkValidTimeSequence ($hash, $runtime_string_first, $runtime_string_next) or return;
|
||||
|
||||
$params = {
|
||||
hash => $hash,
|
||||
@ -11964,6 +11948,30 @@ sub DbRep_numval {
|
||||
return $val;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# prüft die logische Gültigkeit der Zeitgrenzen
|
||||
# $runtime_string_first und $runtime_string_next
|
||||
################################################################
|
||||
sub DbRep_checkValidTimeSequence {
|
||||
my $hash = shift;
|
||||
my $runtime_string_first = shift;
|
||||
my $runtime_string_next = shift;
|
||||
|
||||
my $valid = 1;
|
||||
|
||||
my ($yyyy1, $mm1, $dd1, $hh1, $min1, $sec1) = $runtime_string_first =~ /(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/x;
|
||||
my ($yyyy2, $mm2, $dd2, $hh2, $min2, $sec2) = $runtime_string_next =~ /(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/x;
|
||||
my $nthants = fhemTimeLocal($sec1, $min1, $hh1, $dd1, $mm1-1, $yyyy1-1900);
|
||||
my $othants = fhemTimeLocal($sec2, $min2, $hh2, $dd2, $mm2-1, $yyyy2-1900);
|
||||
|
||||
if($nthants > $othants) {
|
||||
ReadingsSingleUpdateValue ($hash, "state", "Error - Wrong time limits. The <nn> (days newer than) option must be greater than the <no> (older than) one !", 1);
|
||||
$valid = 0;
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# entfernt führende Mullen einer Zahl
|
||||
################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user