Made sure parsetime returns seconds as integer
This commit is contained in:
parent
091a7785b2
commit
efc6f2f79f
1 changed files with 2 additions and 1 deletions
|
@ -6,6 +6,7 @@ function parsetime($str) {
|
||||||
foreach ($str as $ent) {
|
foreach ($str as $ent) {
|
||||||
if (preg_match('/^(\d+)([smhdwMy])$/',$ent,$mat)!==1)
|
if (preg_match('/^(\d+)([smhdwMy])$/',$ent,$mat)!==1)
|
||||||
return(false);
|
return(false);
|
||||||
|
$mat[1]+=0;
|
||||||
if ($mat[2]=='s')
|
if ($mat[2]=='s')
|
||||||
$secs+=$mat[1];
|
$secs+=$mat[1];
|
||||||
elseif ($mat[2]=='m')
|
elseif ($mat[2]=='m')
|
||||||
|
@ -21,7 +22,7 @@ function parsetime($str) {
|
||||||
elseif ($mat[2]=='y')
|
elseif ($mat[2]=='y')
|
||||||
$secs+=$mat[1]*60*60*24*365;
|
$secs+=$mat[1]*60*60*24*365;
|
||||||
}
|
}
|
||||||
return($secs);
|
return $secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue