mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 03:35:33 +00:00
Calculate time offset only if date.timezone is not set
This commit is contained in:
parent
b7c0e08b7d
commit
8a9dcbb646
@ -21,8 +21,9 @@
|
|||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
date_default_timezone_set("GMT");
|
if(ini_get("date.timezone") == ""){ //No Timezone set
|
||||||
if(strpos(" ".strtoupper(php_uname("s")), " WIN") !== false){
|
date_default_timezone_set("GMT");
|
||||||
|
if(strpos(" ".strtoupper(php_uname("s")), " WIN") !== false){
|
||||||
$time = time();
|
$time = time();
|
||||||
$time -= $time % 60;
|
$time -= $time % 60;
|
||||||
//TODO: Parse different time & date formats by region. ¬¬ world
|
//TODO: Parse different time & date formats by region. ¬¬ world
|
||||||
@ -32,15 +33,16 @@ if(strpos(" ".strtoupper(php_uname("s")), " WIN") !== false){
|
|||||||
exec("date.exe /T", $date);
|
exec("date.exe /T", $date);
|
||||||
$j = array_map("intval", explode(substr($date[0], 2, 1), trim($date[0])));
|
$j = array_map("intval", explode(substr($date[0], 2, 1), trim($date[0])));
|
||||||
$offset = round((mktime($i[0], $i[1], 0, $j[1], $j[0], $j[2]) - $time) / 60) * 60;
|
$offset = round((mktime($i[0], $i[1], 0, $j[1], $j[0], $j[2]) - $time) / 60) * 60;
|
||||||
}else{
|
}else{
|
||||||
exec("date +%s", $t);
|
exec("date +%s", $t);
|
||||||
$offset = round((intval(trim($t[0])) - time()) / 60) * 60;
|
$offset = round((intval(trim($t[0])) - time()) / 60) * 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
$daylight = (int) date("I");
|
||||||
|
|
||||||
|
date_default_timezone_set(timezone_name_from_abbr("", $offset, $daylight));
|
||||||
}
|
}
|
||||||
|
|
||||||
$daylight = (int) date("I");
|
|
||||||
|
|
||||||
date_default_timezone_set(timezone_name_from_abbr("", $offset, $daylight));
|
|
||||||
|
|
||||||
gc_enable();
|
gc_enable();
|
||||||
error_reporting(E_ALL | E_STRICT);
|
error_reporting(E_ALL | E_STRICT);
|
||||||
ini_set("allow_url_fopen", 1);
|
ini_set("allow_url_fopen", 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user