From 42710f0455c95d6250f9fbf3a2b1ca469d2d6e2d Mon Sep 17 00:00:00 2001 From: Jo Sutton Date: Fri, 5 Apr 2024 13:43:46 +1300 Subject: [PATCH] python:nt_time: Add NT_TIME_MAX constant Signed-off-by: Jo Sutton Reviewed-by: Andrew Bartlett --- python/samba/nt_time.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/samba/nt_time.py b/python/samba/nt_time.py index ff6903c8e68..098748f4f3c 100644 --- a/python/samba/nt_time.py +++ b/python/samba/nt_time.py @@ -25,6 +25,7 @@ import re NtTime = NewType("NtTime", int) NtTimeDelta = NewType("NtTimeDelta", int) +NT_TIME_MAX = NtTime((1 << 64) - 1) NT_EPOCH = datetime.datetime(1601, 1, 1, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) NT_TICKS_PER_μSEC = 10 @@ -34,7 +35,7 @@ NT_TICKS_PER_SEC = NT_TICKS_PER_μSEC * 1_000_000 def _validate_nt_time(nt_time: NtTime) -> None: if not isinstance(nt_time, int): raise ValueError(f"{nt_time} is not an integer") - if not 0 <= nt_time < 2**64: + if not 0 <= nt_time <= NT_TIME_MAX: raise ValueError(f"{nt_time} is out of range")