mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-08 13:33:42 +08:00
14 lines
501 B
Python
14 lines
501 B
Python
"""Optional observer wait state, never a physical sample or authority receipt."""
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class PendingPhysical:
|
|
mono_ns: int
|
|
received_ns: int
|
|
context_changed: bool = False
|
|
|
|
def fresh(self, now_ns):
|
|
return bool(type(self.context_changed) is bool and all(type(value) is int and value > 0 for value in (self.mono_ns, self.received_ns, now_ns)) and
|
|
self.mono_ns <= self.received_ns <= now_ns and now_ns - self.mono_ns <= 100_000_000)
|