2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-10 08:04:00 +00:00

99_Utils.pm: modified time_str2num, an empty value will be returned sysdate

git-svn-id: https://svn.fhem.de/fhem/trunk@3595 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tobiasfaust 2013-08-05 05:38:48 +00:00
parent 8125fdcec4
commit 5e27d0948d

View File

@ -16,8 +16,14 @@ sub
time_str2num($)
{
my ($str) = @_;
my @a = split("[- :]", $str);
return mktime($a[5],$a[4],$a[3],$a[2],$a[1]-1,$a[0]-1900,0,0,-1);
my @a;
if($str ne "") {
@a = split("[- :]", $str);
return mktime($a[5],$a[4],$a[3],$a[2],$a[1]-1,$a[0]-1900,0,0,-1);
} else {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
return mktime($sec, $min, $hour, $mday, $mon, $year, 0, 0, -1);
}
}
sub