Minor perf enhancement
This commit is contained in:
parent
14719d1b7a
commit
07a6ee67e2
@ -100,25 +100,23 @@ function getServerTimeZoneInt($refgmtdate='now')
|
|||||||
// Method 2 (does not include daylight, not supported by adodb)
|
// Method 2 (does not include daylight, not supported by adodb)
|
||||||
if ($refgmtdate == 'now')
|
if ($refgmtdate == 'now')
|
||||||
{
|
{
|
||||||
|
if (ini_get("date.timezone")=='UTC') return 0;
|
||||||
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE.
|
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE.
|
||||||
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');
|
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');
|
||||||
if (dol_stringtotime($_SESSION['dol_dst_first']) <= $gmtnow && $gmtnow < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
if (dol_stringtotime($_SESSION['dol_dst_first']) <= $gmtnow && $gmtnow < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
||||||
else $daylight=0;
|
else $daylight=0;
|
||||||
$tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600);
|
$tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600);
|
||||||
if (ini_get("date.timezone")=='UTC') return 0;
|
//return 'unknown'; // For true result (commented for compatibility result)
|
||||||
return $tmp; // For compatibility result
|
|
||||||
//return 'unknown'; // For true result
|
|
||||||
}
|
}
|
||||||
elseif ($refgmtdate == 'summer')
|
elseif ($refgmtdate == 'summer')
|
||||||
{
|
{
|
||||||
|
if (ini_get("date.timezone")=='UTC') return 0;
|
||||||
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE.
|
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE.
|
||||||
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref='08'; $dayref='01';
|
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref='08'; $dayref='01';
|
||||||
if (dol_stringtotime($_SESSION['dol_dst_first']) <= dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) && dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
if (dol_stringtotime($_SESSION['dol_dst_first']) <= dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) && dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
||||||
else $daylight=0;
|
else $daylight=0;
|
||||||
$tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600);
|
$tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600);
|
||||||
if (ini_get("date.timezone")=='UTC') return 0;
|
//return 'unknown'; // For true result (commented for compatibility result)
|
||||||
return $tmp; // For compatibility result
|
|
||||||
//return 'unknown'; // For true result
|
|
||||||
}
|
}
|
||||||
else $tmp=dol_mktime(0,0,0,1,1,1970);
|
else $tmp=dol_mktime(0,0,0,1,1,1970);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user