added converter to bsread timestamps
This commit is contained in:
@@ -5,5 +5,6 @@ from .bufjson import BufferedJSON
|
||||
from .filehandler import FileHandler
|
||||
from .randskip import randskip
|
||||
from .sorter import Sorter
|
||||
from .timestamp import make_bsread_timestamp
|
||||
|
||||
|
||||
|
||||
15
dap/utils/timestamp.py
Normal file
15
dap/utils/timestamp.py
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
NANOS_PER_S = 10**9
|
||||
NANOS_PER_MILLIS = 10**6
|
||||
|
||||
|
||||
def make_bsread_timestamp(ts, pid):
|
||||
"""
|
||||
ts is assumed to be from time.time_ns() and NOT from time.time()
|
||||
"""
|
||||
secs, nanosecs = divmod(ts, NANOS_PER_S)
|
||||
nanosecs = (nanosecs // NANOS_PER_MILLIS) * NANOS_PER_MILLIS + (pid % NANOS_PER_MILLIS)
|
||||
return secs, nanosecs
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user