Fix DHCP lease time display, strftime already convert it to local timezone, so we no need to calc offset

This commit is contained in:
Renato Botelho 2013-12-23 17:27:59 -02:00
parent f2aa828754
commit 56301bed30

View File

@ -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)