Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fp-time
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Aug 22, 2023
2 parents 73b7511 + 6a41bf6 commit af65e12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions messaging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@
NO_TRAVERSAL_LIMIT = 2**64-1
AVG_FREQ_HISTORY = 100

# sec_since_boot is faster, but allow to run standalone too
try:
from common.realtime import sec_since_boot
except ImportError:
sec_since_boot = time.time
print("Warning, using python time.time() instead of faster sec_since_boot")

context = Context()


Expand All @@ -50,7 +43,7 @@ def log_from_bytes(dat: bytes) -> capnp.lib.capnp._DynamicStructReader:

def new_message(service: Optional[str] = None, size: Optional[int] = None) -> capnp.lib.capnp._DynamicStructBuilder:
dat = log.Event.new_message()
dat.logMonoTime = int(sec_since_boot() * 1e9)
dat.logMonoTime = int(time.monotonic() * 1e9)
dat.valid = True
if service is not None:
if size is None:
Expand Down Expand Up @@ -213,7 +206,7 @@ def update(self, timeout: int = 1000) -> None:
# non-blocking receive for non-polled sockets
for s in self.non_polled_services:
msgs.append(recv_one_or_none(self.sock[s]))
self.update_msgs(sec_since_boot(), msgs)
self.update_msgs(time.monotonic(), msgs)

def update_msgs(self, cur_time: float, msgs: List[capnp.lib.capnp._DynamicStructReader]) -> None:
self.frame += 1
Expand Down
2 changes: 1 addition & 1 deletion services.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, port: int, should_log: bool, frequency: float, decimation: Op
"gyroscope2": (True, 100., 100),
"accelerometer": (True, 104., 104),
"accelerometer2": (True, 100., 100),
"magnetometer": (True, 100., 100),
"magnetometer": (True, 25., 25),
"lightSensor": (True, 100., 100),
"temperatureSensor": (True, 100., 100),
"gpsNMEA": (True, 9.),
Expand Down

0 comments on commit af65e12

Please sign in to comment.