summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErkki Eilonen <erkki@itech.ee>2025-01-07 22:28:48 +0700
committerGitHub <noreply@github.com>2025-01-07 16:28:48 +0100
commitfe50656a6f1509976d04e8a750083d54bad28ecc (patch)
treef3acb8b6a1e4a9e747159d4ac7056de2e6176f6c
parent08c00548ec11329774d315f745dbbd007c986bfe (diff)
downloadvyos-1x-fe50656a6f1509976d04e8a750083d54bad28ecc.tar.gz
vyos-1x-fe50656a6f1509976d04e8a750083d54bad28ecc.zip
T6998: dhcp: fix depracted utcfromtimestamp usage
Deprecated as per https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp Fixes: TypeError: can't subtract offset-naive and offset-aware datetimes Co-authored-by: Erkki Eilonen <erkki@bearmetal.eu>
-rwxr-xr-xsrc/op_mode/dhcp.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py
index 1429fd7b1..20f54df25 100755
--- a/src/op_mode/dhcp.py
+++ b/src/op_mode/dhcp.py
@@ -101,8 +101,8 @@ def _get_raw_server_leases(family='inet', pool=None, sorted=None, state=[], orig
lifetime = lease['valid-lft']
expiry = (lease['cltt'] + lifetime)
- lease['start_timestamp'] = datetime.utcfromtimestamp(expiry - lifetime)
- lease['expire_timestamp'] = datetime.utcfromtimestamp(expiry) if expiry else None
+ lease['start_timestamp'] = datetime.fromtimestamp(expiry - lifetime, timezone.utc)
+ lease['expire_timestamp'] = datetime.fromtimestamp(expiry, timezone.utc) if expiry else None
data_lease = {}
data_lease['ip'] = lease['ip-address']