mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 19:04:20 +00:00
33_readingsHistory.pm: strftime workaround. see forum: https://forum.fhem.de/index.php/topic,85132.15.html
git-svn-id: https://svn.fhem.de/fhem/trunk@18976 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
82883063f4
commit
73a7c2f77e
@ -356,13 +356,33 @@ readingsHistory_detailFn()
|
|||||||
return readingsHistory_2html($d);
|
return readingsHistory_2html($d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# In newer perl versions (>=5.22) POSIX::strftime() returns special chars in ISO-8859 instead of active locale (see: https://forum.fhem.de/index.php/topic,85132.msg777667.html#msg777667 )
|
||||||
|
sub readingsHistory_strftime(@)
|
||||||
|
{
|
||||||
|
my $string = POSIX::strftime(@_);
|
||||||
|
|
||||||
|
$string =~ s/\xe4/ä/g;
|
||||||
|
$string =~ s/\xc4/Ä/g;
|
||||||
|
$string =~ s/\xf6/ö/g;
|
||||||
|
$string =~ s/\xd6/Ö/g;
|
||||||
|
$string =~ s/\xfc/ü/g;
|
||||||
|
$string =~ s/\xdc/Ü/g;
|
||||||
|
$string =~ s/\xdf/ß/g;
|
||||||
|
$string =~ s/\xdf/ß/g;
|
||||||
|
$string =~ s/\xe1/á/g;
|
||||||
|
$string =~ s/\xe9/é/g;
|
||||||
|
$string =~ s/\xc1/Á/g;
|
||||||
|
$string =~ s/\xc9/É/g;
|
||||||
|
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
sub
|
sub
|
||||||
readingsHistory_makeTimestamp($$) {
|
readingsHistory_makeTimestamp($$) {
|
||||||
my ($t, $timestampFormat) = @_;
|
my ($t, $timestampFormat) = @_;
|
||||||
|
|
||||||
my @lt = localtime($t);
|
my @lt = localtime($t);
|
||||||
|
|
||||||
return strftime( $timestampFormat, @lt ) if( $timestampFormat );
|
return readingsHistory_strftime( $timestampFormat, @lt ) if( $timestampFormat );
|
||||||
|
|
||||||
return sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0] );
|
return sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0] );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user