From 9d4aa35b7bdb910129abdcef83a9cc4bc791285d Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Thu, 8 Feb 2018 11:57:49 +0000 Subject: [PATCH] 98_SVG.pm: implement endPlotNow&endPlotToday for fixedRange year (Forum #18267) git-svn-id: https://svn.fhem.de/fhem/trunk@16117 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_SVG.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index 18189adeb..8876ec18e 100644 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -1056,10 +1056,22 @@ SVG_calcOffsets($$) } elsif($zoom eq "year") { my @l = localtime($now); - $l[5] += $off; - $SVG_devs{$d}{from} = sprintf("%04d-01-01_00:00:00", $l[5]+1900); - $SVG_devs{$d}{to} = sprintf("%04d-01-01_00:00:01", $l[5]+1901); + if(SVG_Attr($FW_wname, $wl, "endPlotToday", undef)) { + $l[5] += ($off-1); $l[3]++; # 00:00 off+1 years ago + $SVG_devs{$d}{from} = SVG_tspec(3, 0, @l); + $l[5]++; $l[3]--; $l[2]=23; $l[1]=59; # today, 23:59 + $SVG_devs{$d}{to} = SVG_tspec(0, 59, @l); + } elsif(SVG_Attr($FW_wname, $wl, "endPlotNow", undef)) { + $l[5] += ($off-1); $l[3]++; # Now, off+1 years ago + $SVG_devs{$d}{from} = SVG_tspec(0, $l[0], @l); + $l[5]++; $l[3]--; # now + $SVG_devs{$d}{to} = SVG_tspec(0, $l[0], @l); + + } else { + $SVG_devs{$d}{from} = SVG_tspec(0, 0, 0, 0, 0, 1, 0,$l[5]);#Jan01 00:00:00 + $SVG_devs{$d}{to} = SVG_tspec(0,59,59,59,23,31,11,$l[5]);#Dec31 23:59:59 + } } }