Update status_dhcpv6_leases.php

Fix to correct UTC and local time corerctly. Invert the local/gmt selection and subtract the offset rather than add corrects it.
This commit is contained in:
Martin Wasley 2019-01-08 06:36:58 +00:00 committed by Franco Fichtner
parent 5a95ccfef3
commit 03d06437b3

View File

@ -50,11 +50,11 @@ function adjust_gmt($dt)
$timezone = $config['system']['timezone'];
$ts = strtotime($dt . " GMT");
if ($dhcpv6leaseinlocaltime == "yes") {
if ($dhcpv6leaseinlocaltime != "yes") {
$this_tz = new DateTimeZone($timezone);
$dhcp_lt = new DateTime(strftime("%I:%M:%S%p", $ts), $this_tz);
$offset = $this_tz->getOffset($dhcp_lt);
$ts = $ts + $offset;
$ts = $ts - $offset;
return strftime("%Y/%m/%d %I:%M:%S%p", $ts);
} else {
return strftime("%Y/%m/%d %H:%M:%S", $ts);