replace custom clock helpers with time module (#29499)
* replace custom clock stuff wtih time module
* fix double
* fix release
* bump cereal
* update type
* fix one more
old-commit-hash: d61f86d339
beeps
parent
3022f06e1e
commit
51634f52dc
16 changed files with 52 additions and 78 deletions
@ -1 +1 @@ |
||||
Subproject commit 1ee48e0110a46fbdd9db50ed89a38bb5a748cfcb |
||||
Subproject commit 3cac040c5b219402cb9b234d53c78a6007298534 |
@ -1,24 +0,0 @@ |
||||
# distutils: language = c++ |
||||
# cython: language_level = 3 |
||||
from posix.time cimport clock_gettime, timespec, CLOCK_MONOTONIC_RAW, clockid_t |
||||
|
||||
IF UNAME_SYSNAME == "Darwin": |
||||
# Darwin doesn't have a CLOCK_BOOTTIME |
||||
CLOCK_BOOTTIME = CLOCK_MONOTONIC_RAW |
||||
ELSE: |
||||
from posix.time cimport CLOCK_BOOTTIME |
||||
|
||||
cdef double readclock(clockid_t clock_id): |
||||
cdef timespec ts |
||||
cdef double current |
||||
|
||||
clock_gettime(clock_id, &ts) |
||||
current = ts.tv_sec + (ts.tv_nsec / 1000000000.) |
||||
return current |
||||
|
||||
def monotonic_time(): |
||||
return readclock(CLOCK_MONOTONIC_RAW) |
||||
|
||||
def sec_since_boot(): |
||||
return readclock(CLOCK_BOOTTIME) |
||||
|
Loading…
Reference in new issue