summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndrajit Raychaudhuri <irc@indrajit.com>2026-05-27 21:46:25 -0500
committerIndrajit Raychaudhuri <irc@indrajit.com>2026-05-29 00:36:35 -0500
commitb5798692e8796d1682143046eaee2fc684f11e92 (patch)
treeb34ff8547904a9093d2f187dcd864f2b97e259b8
parent1bdf8747c28b4278f6bef9b5d54378795f83b57d (diff)
downloadvyos-1x-b5798692e8796d1682143046eaee2fc684f11e92.tar.gz
vyos-1x-b5798692e8796d1682143046eaee2fc684f11e92.zip
dhcp: T8933: Honor system timezone for timestamp display in op mode
The time displayed in DHCP v4/v6 server lease op-mode commands should honor system timezone and not force UTC timezone. This would keep the timestamps in the output of `show log dhcp server` or `show log dhcpv6 server` consistent with the timestamps in the output of `show dhcp server leases` or `show dhcpv6 server leases` commands.
-rwxr-xr-xsrc/op_mode/dhcp.py19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py
index 9cb5a84ae..1f8d85823 100755
--- a/src/op_mode/dhcp.py
+++ b/src/op_mode/dhcp.py
@@ -19,7 +19,6 @@ import sys
import typing
from datetime import datetime
-from datetime import timezone
from glob import glob
from ipaddress import ip_address
from tabulate import tabulate
@@ -105,12 +104,8 @@ def _get_formatted_server_leases(raw_data, family='inet'):
ipaddr = lease.get('ip')
hw_addr = lease.get('mac')
state = lease.get('state')
- start = datetime.fromtimestamp(lease.get('start'), timezone.utc)
- end = (
- datetime.fromtimestamp(lease.get('end'), timezone.utc)
- if lease.get('end')
- else '-'
- )
+ start = datetime.fromtimestamp(lease.get('start'))
+ end = datetime.fromtimestamp(lease.get('end')) if lease.get('end') else '-'
remain = lease.get('remaining')
pool = lease.get('pool')
hostname = lease.get('hostname')
@@ -136,14 +131,8 @@ def _get_formatted_server_leases(raw_data, family='inet'):
ipaddr = lease.get('ip')
hw_addr = lease.get('mac')
state = lease.get('state')
- start = datetime.fromtimestamp(
- lease.get('last_communication'), timezone.utc
- )
- end = (
- datetime.fromtimestamp(lease.get('end'), timezone.utc)
- if lease.get('end')
- else '-'
- )
+ start = datetime.fromtimestamp(lease.get('last_communication'))
+ end = datetime.fromtimestamp(lease.get('end')) if lease.get('end') else '-'
remain = lease.get('remaining')
lease_type = lease.get('type')
pool = lease.get('pool')