mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-18 12:06:04 +00:00
90_at.pm: function may return absolute dates (Forum #116377)
git-svn-id: https://svn.fhem.de/fhem/trunk@23278 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f09c3ace72
commit
013745c067
@ -74,7 +74,21 @@ at_Define($$)
|
||||
|
||||
} else {
|
||||
($err, $hr, $min, $sec, $fn) = GetTimeSpec($tspec);
|
||||
return $err if($err);
|
||||
if($err) { # $fn contains the result, try again
|
||||
my $ntspec = $fn;
|
||||
$fn = undef;
|
||||
if($ntspec =~ m/^\d{10}$/) {
|
||||
$abstime = $ntspec;
|
||||
|
||||
} elsif($ntspec =~ m/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)$/) {
|
||||
my ($y,$m,$d,$h,$m2,$s) = ($1,$2,$3,$4,$5,$6);
|
||||
$abstime = mktime($s,$m2,$h,$d,$m-1,$y-1900, 0,0,-1);
|
||||
|
||||
} else {
|
||||
return $err;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return "datespec is not allowed with + or *" if($abstime && ($rel || $rep));
|
||||
|
@ -3633,7 +3633,7 @@ GetTimeSpec($)
|
||||
my ($err, $fn2);
|
||||
($err, $hr, $min, $sec, $fn2) = GetTimeSpec($tspec);
|
||||
return ("the function \"$fn\" must return a timespec and not $tspec.",
|
||||
undef, undef, undef, undef) if($err);
|
||||
undef, undef, undef, $tspec) if($err);
|
||||
|
||||
} else {
|
||||
return ("Wrong timespec $tspec: either HH:MM:SS or {perlcode}",
|
||||
|
Loading…
x
Reference in New Issue
Block a user