aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/DataStructures.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze/DataStructures.py')
-rw-r--r--src/argaze/DataStructures.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/argaze/DataStructures.py b/src/argaze/DataStructures.py
index d3b6544..cf5bc3a 100644
--- a/src/argaze/DataStructures.py
+++ b/src/argaze/DataStructures.py
@@ -13,7 +13,8 @@ import collections
import json
import ast
import bisect
-import threading, traceback, sys
+import threading
+import math
import pandas
import numpy
@@ -105,6 +106,7 @@ class SharedObject():
def __init__(self):
self._lock = threading.Lock()
+ self._timestamp = math.nan
def acquire(self):
self._lock.acquire()
@@ -115,11 +117,17 @@ class SharedObject():
def locked(self) -> bool:
return self._lock.locked()
- def __enter__(self):
- self.acquire()
+ @property
+ def timestamp(self) -> int|float:
+ """Get timestamp"""
+
+ return self._timestamp
+
+ @timestamp.setter
+ def timestamp(self, timestamp: int|float):
+ """Set timestamp"""
- def __exit__(self, type, value, traceback):
- self.release()
+ self._timestamp = timestamp
class TimeStampedBuffer(collections.OrderedDict):
"""Ordered dictionary to handle timestamped data.