From: Jo Sutton Date: Fri, 5 Apr 2024 00:43:46 +0000 (+1300) Subject: python:nt_time: Add NT_TIME_MAX constant X-Git-Tag: tdb-1.4.11~1116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42710f0455c95d6250f9fbf3a2b1ca469d2d6e2d;p=thirdparty%2Fsamba.git python:nt_time: Add NT_TIME_MAX constant Signed-off-by: Jo Sutton Reviewed-by: Andrew Bartlett --- 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")