From d8b37f910e2b864e3eaa159aeacbbd37c40198a9 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 23 Dec 2013 17:27:59 -0200 Subject: Fix DHCP lease time display, strftime already convert it to local timezone, so we no need to calc offset --- usr/local/www/status_dhcp_leases.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'usr') diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index 78733db..b7624d8 100755 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -99,22 +99,16 @@ function leasecmp($a, $b) { function adjust_gmt($dt) { global $config; $dhcpd = $config['dhcpd']; - foreach ($dhcpd as $dhcpleaseinlocaltime) { - $dhcpleaseinlocaltime = $dhcpleaseinlocaltime['dhcpleaseinlocaltime']; + foreach ($dhcpd as $dhcpditem) { + $dhcpleaseinlocaltime = $dhcpditem['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; + $ts = strtotime($dt . " GMT"); return strftime("%Y/%m/%d %I:%M:%S%p", $ts); - } - else - return strftime("%Y/%m/%d %H:%M:%S", $ts); + } else + return $dt; } function remove_duplicate($array, $field) -- cgit v1.1