2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00

98_logProxy.pm: added logProxy_hms2sec and logProxy_isDay

git-svn-id: https://svn.fhem.de/fhem/trunk@9653 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2015-10-25 10:27:29 +00:00
parent f539c4b36d
commit 617b5fde8b

View File

@ -353,6 +353,27 @@ logProxy_WeekProfile2Plot($$$;$)
return ($ret,$min,$max,$prev_value);
}
sub logProxy_hms2sec($){
my ($h,$m,$s) = split(":", shift);
$m = 0 if(!$m);
$s = 0 if(!$s);
my $t = $s;
$t += $m * 60;
$t += $h * 60*60;
return ($t)
}
sub logProxy_isDay($) {
my ($sec) = @_;
my $sr = logProxy_hms2sec(sunrise_abs_dat($sec));
my $ss = logProxy_hms2sec(sunset_abs_dat($sec));
my ($s,$m,$h) = localtime($sec);
my $cur = logProxy_hms2sec( "$h:$m:$s" );
return $cur > $sr && $cur < $ss;
}
sub logProxy_hms2dec($){
my ($h,$m,$s) = split(":", shift);
$m = 0 if(!$m);