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

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@3595 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tobiasfaust
2013-08-05 05:38:48 +00:00
parent f2113d89dd
commit 4306c28e0b

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