Expose Duration units and add a Nanoseconds function to let us build against 0.6.0

This commit is contained in:
Ben Moran
2017-06-08 12:01:11 +01:00
parent 98b5ed837b
commit fbc1767475
2 changed files with 12 additions and 2 deletions

View File

@@ -101,7 +101,14 @@ ctypedef Promise[PyArray] PyPromiseArray
cdef extern from "kj/time.h" namespace " ::kj":
cdef cppclass Duration:
Duration(int64_t)
Duration operator*(int64_t)
Duration NANOSECONDS
Duration MICROSECONDS
Duration MILLISECONDS
Duration SECONDS
Duration MINUTES
Duration HOURS
Duration DAYS
# cdef cppclass TimePoint:
# TimePoint(Duration)
cdef cppclass Timer:
@@ -109,6 +116,9 @@ cdef extern from "kj/time.h" namespace " ::kj":
# VoidPromise atTime(TimePoint time)
VoidPromise afterDelay(Duration delay)
cdef inline Duration Nanoseconds(int64_t nanos):
return NANOSECONDS * nanos
cdef extern from "kj/async-io.h" namespace " ::kj":
cdef cppclass AsyncIoStream:
pass