mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 03:28:18 +01:00
Fix bug reported by scrutinizer
This commit is contained in:
@@ -1949,7 +1949,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||
|
||||
|
||||
/**
|
||||
* Return date for now. In mot cases, we use this function without parameters (that means GMT time).
|
||||
* Return date for now. In most cases, we use this function without parameters (that means GMT time).
|
||||
*
|
||||
* @param string $mode 'gmt' => we return GMT timestamp,
|
||||
* 'tzserver' => we add the PHP server timezone
|
||||
@@ -1959,7 +1959,8 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||
*/
|
||||
function dol_now($mode='gmt')
|
||||
{
|
||||
$ret='';
|
||||
$ret=0;
|
||||
|
||||
// Note that gmmktime and mktime return same value (GMT) when used without parameters
|
||||
//if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead
|
||||
if ($mode == 'gmt') $ret=time(); // Time for now at greenwich.
|
||||
@@ -1967,7 +1968,7 @@ function dol_now($mode='gmt')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$tzsecond=getServerTimeZoneInt('now'); // Contains tz+dayling saving time
|
||||
$ret=dol_now('gmt')+($tzsecond*3600);
|
||||
$ret=(int) dol_now('gmt')+($tzsecond*3600);
|
||||
}
|
||||
/*else if ($mode == 'tzref') // Time for now with parent company timezone is added
|
||||
{
|
||||
@@ -1980,8 +1981,9 @@ function dol_now($mode='gmt')
|
||||
//print 'eeee'.time().'-'.mktime().'-'.gmmktime();
|
||||
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60;
|
||||
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60;
|
||||
$ret=dol_now('gmt')+($offsettz+$offsetdst);
|
||||
$ret=(int) dol_now('gmt')+($offsettz+$offsetdst);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user