@@ -35,8 +35,8 @@ pjoin = os.path.join
|
||||
# Constants
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
bundled_version = (0,5,3,1)
|
||||
libcapnp = "capnproto-c++-%i.%i.%i.%i.tar.gz" % (bundled_version)
|
||||
bundled_version = (0,6,0)
|
||||
libcapnp = "capnproto-c++-%i.%i.%i.tar.gz" % (bundled_version)
|
||||
libcapnp_url = "https://capnproto.org/" + libcapnp
|
||||
|
||||
HERE = os.path.dirname(__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
|
||||
|
||||
@@ -1688,7 +1688,7 @@ cdef class _Timer:
|
||||
return self
|
||||
|
||||
cpdef after_delay(self, time) except +reraise_kj_exception:
|
||||
return _VoidPromise()._init(self.thisptr.afterDelay(capnp.Duration(time)))
|
||||
return _VoidPromise()._init(self.thisptr.afterDelay(capnp.Nanoseconds(time)))
|
||||
|
||||
def getTimer():
|
||||
return _Timer()._init(helpers.getTimer(C_DEFAULT_EVENT_LOOP_GETTER().thisptr))
|
||||
|
||||
Reference in New Issue
Block a user