diff options
Diffstat (limited to 'usr/local/www/status_dhcp_leases.php')
-rwxr-xr-x | usr/local/www/status_dhcp_leases.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index ba18b72..f1dec97 100755 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -44,6 +44,7 @@ ##|-PRIV require("guiconfig.inc"); +require_once("config.inc"); $pgtitle = array(gettext("Status"),gettext("DHCP leases")); @@ -94,8 +95,24 @@ function leasecmp($a, $b) { } function adjust_gmt($dt) { - $ts = strtotime($dt . " GMT"); - return strftime("%Y/%m/%d %H:%M:%S", $ts); + global $config; + $dhcpd = $config['dhcpd']; + foreach ($dhcpd as $dhcpleaseinlocaltime) { + $dhcpleaseinlocaltime = $dhcpleaseinlocaltime['dhcpleaseinlocaltime']; + if ($dhcpleaseinlocaltime == "yes") + break; + } + $timezone = $config['system']['timezone']; + $ts = strtotime($dt . " GMT"); + if ($dhcpleaseinlocaltime == "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; + return strftime("%Y/%m/%d %I:%M:%S%p", $ts); + } + else + return strftime("%Y/%m/%d %H:%M:%S", $ts); } function remove_duplicate($array, $field) |