File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,15 @@ def cb():
59
59
60
60
self .assertFalse (self .loop .is_closed ())
61
61
62
+ def test_now_update (self ):
63
+ async def run ():
64
+ st = self .loop .time ()
65
+ time .sleep (0.05 )
66
+ return self .loop .time () - st
67
+
68
+ delta = self .loop .run_until_complete (run ())
69
+ self .assertTrue (delta > 0.049 and delta < 0.6 )
70
+
62
71
def test_call_later (self ):
63
72
calls = []
64
73
Original file line number Diff line number Diff line change @@ -264,6 +264,7 @@ cdef extern from "uv.h" nogil:
264
264
int uv_loop_close(uv_loop_t* loop)
265
265
int uv_loop_alive(uv_loop_t* loop)
266
266
267
+ void uv_update_time(uv_loop_t* loop)
267
268
uint64_t uv_now(const uv_loop_t* )
268
269
269
270
int uv_run(uv_loop_t* , uv_run_mode mode) nogil
Original file line number Diff line number Diff line change @@ -395,6 +395,8 @@ cdef class Loop:
395
395
executor.shutdown(wait = False )
396
396
397
397
cdef uint64_t _time(self ):
398
+ # asyncio doesn't have a time cache, neither should uvloop.
399
+ uv.uv_update_time(self .uvloop) # void
398
400
return uv.uv_now(self .uvloop)
399
401
400
402
cdef inline _queue_write(self , UVStream stream):
You can’t perform that action at this time.
0 commit comments