From 468618f0da3cd02bf6e10144fc1d696e9fa40737 Mon Sep 17 00:00:00 2001 From: Joecowboy Date: Sat, 25 Feb 2012 15:32:18 -0600 Subject: Added the the choice for DHCPv6 leases of local time over default UTC time. --- usr/local/www/status_dhcpv6_leases.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'usr/local/www') diff --git a/usr/local/www/status_dhcpv6_leases.php b/usr/local/www/status_dhcpv6_leases.php index 6153259..c4d7aa7 100644 --- a/usr/local/www/status_dhcpv6_leases.php +++ b/usr/local/www/status_dhcpv6_leases.php @@ -45,6 +45,7 @@ ##|-PRIV require("guiconfig.inc"); +require_once("config.inc"); $pgtitle = array(gettext("Status"),gettext("DHCPv6 leases")); @@ -95,8 +96,20 @@ function leasecmp($a, $b) { } function adjust_gmt($dt) { + global $config; + $sysctl = $config['system']; + $timezone = $sysctl['timezone']; + $timeformatchangev6 = $sysctl['timeformatchangev6']; $ts = strtotime($dt . " GMT"); - return strftime("%Y/%m/%d %H:%M:%S", $ts); + if ($timeformatchangev6 == "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) { -- cgit v1.1