mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
I now parses the xml tags in the dhcpd to check if an interface for DHCP lease is using local time if not defaults to UTC time.
This commit is contained in:
parent
138208bf77
commit
e085eba589
@ -95,18 +95,19 @@ function leasecmp($a, $b) {
|
||||
}
|
||||
|
||||
function adjust_gmt($dt) {
|
||||
global $config;
|
||||
$sysctl = $config['system'];
|
||||
$timezone = $sysctl['timezone'];
|
||||
$timeformatchange = $sysctl['timeformatchange'];
|
||||
global $config;
|
||||
$dhcpd = $config['dhcpd'];
|
||||
foreach ($dhcpd as $dhcpleaseinlocaltime)
|
||||
$dhcpleaseinlocaltime = $dhcpleaseinlocaltime['dhcpleaseinlocaltime'];
|
||||
$timezone = $config['system']['timezone'];
|
||||
$ts = strtotime($dt . " GMT");
|
||||
if ($timeformatchange == "yes") {
|
||||
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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user