2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00

93_DbRep: calc issue due to daylight saving time end (winter time)

git-svn-id: https://svn.fhem.de/fhem/trunk@12479 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2016-10-31 14:21:51 +00:00
parent e1b7253f9c
commit 9c6f0122b4
2 changed files with 21 additions and 9 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: 93_DbRep: calc issue due to daylight saving time end (winter time)
- new: 30_pilight_raw.pm: New Attribut sendCount
- bugfix: 10_SOMFY: wrong attribute reference ...-up-time-to-close removed
- new: 42_Nextion.pm: New module to connect Nextion displays

View File

@ -37,6 +37,7 @@
###########################################################################################################
# Versions History:
#
# 4.6 31.10.2016 bugfix calc issue due to daylight saving time end (winter time)
# 4.5.1 18.10.2016 get svrinfo contains SQLite database file size (MB),
# modified timeout routine
# 4.5 17.10.2016 get data of dbstatus, dbvars, tableinfo, svrinfo (database dependend)
@ -853,6 +854,8 @@ $hash->{HELPER}{CV} = \%cv;
# Aufbau Timestampstring mit Zeitgrenzen entsprechend Aggregation
while (!$ll) {
# collect aggregation strings
($runtime,$runtime_string,$runtime_string_first,$runtime_string_next,$ll) = collaggstr($hash,$runtime,$i,$runtime_string_next);
@ -973,6 +976,7 @@ sub averval_DoParse($) {
# Timestampstring to Array
my @ts = split("\\|", $ts);
Log3 ($name, 5, "DbRep $name - Timestamp-Array: \n@ts");
# SQL-Startzeit
my $st = [gettimeofday];
@ -1138,6 +1142,7 @@ sub count_DoParse($) {
# Timestampstring to Array
my @ts = split("\\|", $ts);
Log3 ($name, 5, "DbRep $name - Timestamp-Array: \n@ts");
# SQL-Startzeit
my $st = [gettimeofday];
@ -1304,6 +1309,7 @@ sub maxval_DoParse($) {
# Timestampstring to Array
my @ts = split("\\|", $ts);
Log3 ($name, 5, "DbRep $name - Timestamp-Array: \n@ts");
# SQL-Startzeit
my $st = [gettimeofday];
@ -1537,6 +1543,7 @@ sub minval_DoParse($) {
# Timestampstring to Array
my @ts = split("\\|", $ts);
Log3 ($name, 5, "DbRep $name - Timestamp-Array: \n@ts");
# SQL-Startzeit
my $st = [gettimeofday];
@ -1770,6 +1777,7 @@ sub diffval_DoParse($) {
# Timestampstring to Array
my @ts = split("\\|", $ts);
Log3 ($name, 5, "DbRep $name - Timestamp-Array: \n@ts");
# SQL-Startzeit
my $st = [gettimeofday];
@ -2018,6 +2026,7 @@ sub sumval_DoParse($) {
# Timestampstring to Array
my @ts = split("\\|", $ts);
Log3 ($name, 5, "DbRep $name - Timestamp-Array: \n@ts");
# SQL-Startzeit
my $st = [gettimeofday];
@ -3293,8 +3302,8 @@ sub collaggstr($$$$) {
# Monatsaggregation
if ($aggregation eq "month") {
$runtime_orig = $runtime;
$runtime = $runtime+3600 if((strftime "%m", localtime($runtime)) eq "10"); # Korrektur Winterzeitumstellung (Uhr wurde 1 Stunde zurück gestellt
# Hilfsrechnungen
my $rm = strftime "%m", localtime($runtime); # Monat des aktuell laufenden Startdatums d. SQL-Select
@ -3302,12 +3311,11 @@ sub collaggstr($$$$) {
my $dim = $rm-2?30+($rm*3%7<4):28+!($ry%4||$ry%400*!($ry%100)); # Anzahl Tage des aktuell laufenden Monats f. SQL-Select
Log3 ($name, 5, "DbRep $name - act year: $ry, act month: $rm, days in month: $dim, endyear: $yestr, endmonth: $mestr");
$runtime_string = strftime "%Y-%m", localtime($runtime); # für Readingname
if ($i==1) {
# nur im ersten Durchlauf
$runtime_string_first = strftime "%Y-%m-%d %H:%M:%S", localtime($runtime);
$runtime_string_first = strftime "%Y-%m-%d %H:%M:%S", localtime($runtime_orig);
}
if ($ysstr == $yestr && $msstr == $mestr || $ry == $yestr && $rm == $mestr) {
@ -3317,7 +3325,7 @@ sub collaggstr($$$$) {
} else {
if(($runtime) > $epoch_seconds_end) {
$runtime_string_first = strftime "%Y-%m-01", localtime($runtime) if($i>1);
$runtime_string_first = strftime "%Y-%m-01", localtime($runtime) if($i>11);
$runtime_string_next = strftime "%Y-%m-%d %H:%M:%S", localtime($epoch_seconds_end);
$ll=1;
} else {
@ -3337,6 +3345,7 @@ sub collaggstr($$$$) {
# Wochenaggregation
if ($aggregation eq "week") {
$runtime = $runtime+3600 if((strftime "%m-%d", localtime($runtime)) eq "10-30"); # Korrektur Winterzeitumstellung (Uhr wurde 1 Stunde zuück gestellt)
$runtime_orig = $runtime;
my $w = strftime "%V", localtime($runtime); # Wochennummer des aktuellen Startdatum/Zeit
@ -3379,6 +3388,7 @@ sub collaggstr($$$$) {
# Tagesaggregation
if ($aggregation eq "day") {
$runtime = $runtime+3600 if((strftime "%m-%d", localtime($runtime)) eq "10-30"); # Korrektur Winterzeitumstellung (Uhr wurde 1 Stunde zuück gestellt)
$runtime_string = strftime "%Y-%m-%d", localtime($runtime); # für Readingname
$runtime_string_first = strftime "%Y-%m-%d %H:%M:%S", localtime($runtime) if($i==1);
$runtime_string_first = strftime "%Y-%m-%d", localtime($runtime) if($i>1);
@ -3391,6 +3401,7 @@ sub collaggstr($$$$) {
} else {
$runtime_string_next = strftime "%Y-%m-%d", localtime($runtime+$aggsec);
}
Log3 ($name, 5, "DbRep $name - runtime_string: $runtime_string, runtime_string_first(begin): $runtime_string_first, runtime_string_next(end): $runtime_string_next");
# neue Beginnzeit in Epoche-Sekunden
$runtime = $runtime+$aggsec;