mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 17:12:32 +00:00
92_FileLog.pm: fix createGluedFile for endPlotNow (Forum #139640)
git-svn-id: https://svn.fhem.de/fhem/trunk@29319 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2ca3b4faec
commit
3bc16a5896
@ -836,32 +836,29 @@ FileLog_Get($@)
|
|||||||
} else {
|
} else {
|
||||||
my $linf;
|
my $linf;
|
||||||
if($inf eq "CURRENT") {
|
if($inf eq "CURRENT") {
|
||||||
if($from =~ m/^(....)-(..)-(..)/) { # compute the log filename
|
if($from =~ m/^(....-..-..)_(..:..:..)/) {
|
||||||
my ($fy,$fm,$fd) = ($1,$2,$3);
|
my ($from_ymd, $from_hms) = ($1,$2);
|
||||||
$linf = ResolveDateWildcards($hash->{logfile},
|
$linf = ResolveDateWildcards($hash->{logfile},
|
||||||
localtime(time_str2num("$fy-$fm-$fd 00:00:00")));
|
localtime(time_str2num("$from_ymd $from_hms")));
|
||||||
|
|
||||||
if(AttrVal($name, "createGluedFile", 0)) {
|
if(AttrVal($name, "createGluedFile", 0)) {
|
||||||
$to = (split(" ", TimeNow()))[0] if($to eq "9"); # Special
|
$to = (split(" ", TimeNow()))[0] if($to eq "9"); # Special
|
||||||
if($to =~ m/^(....)-(..)-(..)/) {
|
if($to =~ m/^(....-..-..)_(..:..:..)/) {
|
||||||
my ($ty,$tm,$td) = ($1,$2,$3);
|
my ($to_ymd, $to_hms) = ($1,$2);
|
||||||
my $linf_to = ResolveDateWildcards($hash->{logfile},
|
my $linf_to = ResolveDateWildcards($hash->{logfile},
|
||||||
localtime(time_str2num("$ty-$tm-$td 00:00:00")));
|
localtime(time_str2num("$to_ymd $to_hms")));
|
||||||
if($linf ne $linf_to){ # append each file into a temporary one
|
if($linf ne $linf_to){ # append each file into a temporary one
|
||||||
$tempfileName = $linf.".transit.temp.log";
|
$tempfileName = $linf.".transit.temp.log";
|
||||||
unlink($tempfileName);
|
unlink($tempfileName);
|
||||||
my $lf = $linf;
|
my $lf = $linf;
|
||||||
|
|
||||||
if(open(my $out,'>',$tempfileName)){
|
if(open(my $out,'>',$tempfileName)){
|
||||||
my $sec = time_str2num("$fy-$fm-$fd 00:00:00");
|
my $sec = time_str2num("$from_ymd $from_hms");
|
||||||
my $secTo = time_str2num("$ty-$tm-$td 00:00:00");
|
my $secTo = time_str2num("$to_ymd $to_hms");
|
||||||
if(($secTo-$sec)%86400) { #DST change inbetween, #99215
|
|
||||||
$secTo = $sec + 86400*int(($secTo-$sec+3600)/86400);
|
|
||||||
}
|
|
||||||
my $lastFile = "";
|
my $lastFile = "";
|
||||||
while($sec <= $secTo) { # Loop over each day
|
while($sec <= $secTo) { # Loop over each day
|
||||||
$linf=ResolveDateWildcards($hash->{logfile},localtime($sec));
|
$linf=ResolveDateWildcards($hash->{logfile},localtime($sec));
|
||||||
$sec += 86400;
|
$sec += 3600;
|
||||||
if($linf ne $lastFile) {
|
if($linf ne $lastFile) {
|
||||||
$lastFile = $linf;
|
$lastFile = $linf;
|
||||||
if(open(my $i,'<',$linf)){
|
if(open(my $i,'<',$linf)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user