Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions bumble/snoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ def snoop(self, hci_packet: bytes, direction: Snooper.Direction) -> None:

# Compute the current timestamp
timestamp = (
int((datetime.datetime.utcnow() - self.TIMESTAMP_ANCHOR) / self.ONE_MS)
int(
(
datetime.datetime.now(tz=datetime.timezone.utc)
- self.TIMESTAMP_ANCHOR
)
/ self.ONE_MS
)
+ self.TIMESTAMP_DELTA
)

Expand Down Expand Up @@ -129,7 +135,7 @@ def create_snooper(spec: str) -> Generator[Snooper, None, None]:
records will be written to that file if it can be opened/created.
The keyword args that may be referenced by the string pattern are:
now: the value of `datetime.now()`
utcnow: the value of `datetime.utcnow()`
utcnow: the value of 'datetime.now(tz=datetime.timezone.utc)'
pid: the current process ID.
instance: the instance ID in the current process.

Expand All @@ -153,7 +159,7 @@ def create_snooper(spec: str) -> Generator[Snooper, None, None]:
global _SNOOPER_INSTANCE_COUNT
file_path = io_name.format(
now=datetime.datetime.now(),
utcnow=datetime.datetime.utcnow(),
utcnow=datetime.datetime.now(tz=datetime.timezone.utc),
pid=os.getpid(),
instance=_SNOOPER_INSTANCE_COUNT,
)
Expand Down
Loading