zoeballz
New member
Hi there;
Is there a setting I need to change somewhere ? The strtotime function appears to be returning the wrong time ?
This is my code
When run from ExeOutput, example results are:
When run from a browser (using XAMPP as the server):
The thing to look at is the “unixbattletime” in both outputs. You will see there is a 1 hour difference between the 2. The thing that is even more confusing is that the 2nd strtotime in the script appears to be working just fine !! Is this a bug or a setting I have set wrong on ExeOutput perhaps OR am I being totally thick and missing the obvious ?
Many thanks,
Zoe
Is there a setting I need to change somewhere ? The strtotime function appears to be returning the wrong time ?
This is my code
Code:
$pregresult = preg_match("/\"dateTime\":\"([0-9]{2}\.[0-9]{2}\.[0-9]{4}\s[0-9]{2}:[0-9]{2}:[0-9]{2})/", $filedata, $matches); // GET BATTLE TIME
if ((isset($matches[0])) and (isset($matches[1]))) {
echo "pregmatchedtime = " . $matches[1] . "<br>";
zprint($matches);
$unixbattletime = strtotime($matches[1]);
$actualtime = localtime(null, true);
$localtime = str_pad($actualtime["tm_mday"], 2, "0", STR_PAD_LEFT) . "." . str_pad(($actualtime["tm_mon"] + 1), 2, "0", STR_PAD_LEFT) . "." .
($actualtime["tm_year"] + 1900) . " " . str_pad($actualtime["tm_hour"], 2, "0", STR_PAD_LEFT) . ":" .
str_pad($actualtime["tm_min"], 2, "0", STR_PAD_LEFT) . ":" . str_pad($actualtime["tm_sec"], 2, "0", STR_PAD_LEFT);
$unixlocaltime = strtotime($localtime);
if (($unixbattletime > ($unixlocaltime + 1000)) or ($unixbattletime < ($unixlocaltime - 1000))) $foundtype1 = 0; // IF NEW BATTLE IS NOT ACTUALLY NEW, THEN DO NOT FLAG AS RECENT BATTLE
echo "unixbattletime = $unixbattletime<br>unixlocaltime = $unixlocaltime<br>foundtype1 = $foundtype1<br>";
Code:
pregmatchedtime = 12.10.2023 12:29:40
Array
(
[0] => "dateTime":"12.10.2023 12:29:40
[1] => 12.10.2023 12:29:40
)
unixbattletime = 1697106580 // edit: Thu Oct 12 2023 10:29:40 GMT+0000
unixlocaltime = 1697110570 // edit: Thu Oct 12 2023 11:36:10 GMT+0000
foundtype1 = 0
currenttime = 1697110570
foundtype1 = 0
Replay uploaded at 12:36
D:/World_of_Tanks_EU/replays/20231012_1229_france-F38_Bat_Chatillon155_58_127_japort.wotreplay
Code:
pregmatchedtime = 12.10.2023 12:40:54
Array
(
[0] => "dateTime":"12.10.2023 12:40:54
[1] => 12.10.2023 12:40:54
)
unixbattletime = 1697110854 // edit: Thu Oct 12 2023 11:40:54 GMT+0000
unixlocaltime = 1697111224 // edit: Thu Oct 12 2023 11:47:04 GMT+0000
foundtype1 = 1
currenttime = 1697111224
foundtype1 = 1
Replay uploaded at 12:47
D:/World_of_Tanks_EU/replays/20231012_1240_france-F38_Bat_Chatillon155_58_05_prohorovka.wotreplay
Many thanks,
Zoe
Last edited:
