From 5cd13a98885896ab4d72880527cdfd39e0ad61ba Mon Sep 17 00:00:00 2001 From: Jim Kring Date: Wed, 24 Jan 2024 13:07:03 -0800 Subject: [PATCH] implement __eq__ for TdmsTimestamp type --- nptdms/timestamp.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nptdms/timestamp.py b/nptdms/timestamp.py index 312658a..f486d09 100644 --- a/nptdms/timestamp.py +++ b/nptdms/timestamp.py @@ -30,6 +30,9 @@ def __str__(self): fraction_string = "{0:.6f}".format(self.second_fractions * 2.0 ** -64).split('.')[1] return "{0}.{1}".format(dt, fraction_string) + def __eq__(self, other): + return self.seconds == other.seconds and self.second_fractions == other.second_fractions + def as_datetime64(self, resolution='us'): """ Convert this timestamp to a numpy datetime64 object