mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
secSince2000 fixes
git-svn-id: https://svn.fhem.de/fhem/trunk@1710 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bdb8fa194c
commit
f4e8a7248b
@ -11,6 +11,7 @@ sub HMLAN_Read($);
|
||||
sub HMLAN_Write($$$);
|
||||
sub HMLAN_ReadAnswer($$$);
|
||||
sub HMLAN_uptime($);
|
||||
sub HMLAN_secSince2000();
|
||||
|
||||
sub HMLAN_SimpleWrite(@);
|
||||
|
||||
@ -352,7 +353,7 @@ HMLAN_DoInit($)
|
||||
my $id = AttrVal($name, "hmId", undef);
|
||||
my $key = AttrVal($name, "hmKey", ""); # 36(!) hex digits
|
||||
|
||||
my $s2000 = sprintf("%02X", secSince2000());
|
||||
my $s2000 = sprintf("%02X", HMLAN_secSince2000());
|
||||
|
||||
HMLAN_SimpleWrite($hash, "A$id") if($id);
|
||||
HMLAN_SimpleWrite($hash, "C");
|
||||
@ -376,4 +377,16 @@ HMLAN_KeepAlive($)
|
||||
InternalTimer(gettimeofday()+25, "HMLAN_KeepAlive", $hash, 1);
|
||||
}
|
||||
|
||||
sub
|
||||
HMLAN_secSince2000()
|
||||
{
|
||||
# Calculate the local time in seconds from 2000.
|
||||
my $t = time();
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($t);
|
||||
$t -= 946684800; # seconds between 01.01.2000, 00:00 and THE EPOCH (1970)
|
||||
$t -= 7200; # HM Special
|
||||
$t += fhemTzOffset($t);
|
||||
return $t;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -18,6 +18,7 @@ sub CUL_HM_Set($@);
|
||||
sub CUL_HM_DumpProtocol($$@);
|
||||
sub CUL_HM_convTemp($);
|
||||
sub CUL_HM_pushConfig($$$$$$$$);
|
||||
sub CUL_HM_secSince2000();
|
||||
|
||||
my %culHmDevProps=(
|
||||
"01" => { st => "AlarmControl", cl => "controller" }, # by peterp
|
||||
@ -489,7 +490,7 @@ CUL_HM_Parse($$)
|
||||
|
||||
if($id eq $dst) {
|
||||
if($cmd eq "A03F") { # Timestamp request
|
||||
my $s2000 = sprintf("%02X", secSince2000());
|
||||
my $s2000 = sprintf("%02X", CUL_HM_secSince2000());
|
||||
CUL_HM_SendCmd($shash, "++803F$id${src}0204$s2000",1,0);
|
||||
push @event, "time-request";
|
||||
|
||||
@ -1898,4 +1899,17 @@ CUL_HM_maticFn($$$$$)
|
||||
return $sndcmd;
|
||||
}
|
||||
|
||||
sub
|
||||
CUL_HM_secSince2000()
|
||||
{
|
||||
# Calculate the local time in seconds from 2000.
|
||||
my $t = time();
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($t);
|
||||
$t -= 946684800; # seconds between 01.01.2000, 00:00 and THE EPOCH (1970)
|
||||
$t -= 7200; # HM Special
|
||||
$t += fhemTzOffset($t);
|
||||
return $t;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user