@@ -613,18 +613,23 @@ static void walkHandle(uv_handle_t* h, void* arg) {
613
613
break ;
614
614
}
615
615
case UV_TIMER: {
616
- type = " timer" ;
617
- data << " repeat: " << uv_timer_get_repeat (&(handle->timer ));
618
- // TODO timeout is not actually public however it is present in
619
- // all current versions of libuv. Once uv_timer_get_timeout is
616
+ // TODO timeout/due is not actually public however it is present
617
+ // in all current versions of libuv. Once uv_timer_get_timeout is
620
618
// in a supported level of libuv we should test for it with dlsym
621
619
// and use it instead, in case timeout moves in the future.
622
- data << " , timeout in: "
623
620
#ifdef _WIN32
624
- << (handle-> timer . due - uv_now ( handle->timer .loop )) << " ms " ;
621
+ uint64_t due = handle->timer .due ;
625
622
#else
626
- << ( handle->timer .timeout - uv_now (handle-> timer . loop )) << " ms " ;
623
+ uint64_t due = handle->timer .timeout ;
627
624
#endif
625
+ uint64_t now = uv_now (handle->timer .loop );
626
+ type = " timer" ;
627
+ data << " repeat: " << uv_timer_get_repeat (&(handle->timer ));
628
+ if (due > now) {
629
+ data << " , timeout in: " << (due - now) << " ms" ;
630
+ } else {
631
+ data << " , timeout expired: " << (now - due) << " ms ago" ;
632
+ }
628
633
break ;
629
634
}
630
635
case UV_TTY: {
@@ -701,7 +706,7 @@ static void walkHandle(uv_handle_t* h, void* arg) {
701
706
702
707
if (h->type == UV_TCP || h->type == UV_NAMED_PIPE || h->type == UV_TTY) {
703
708
704
- data << " , write queue size "
709
+ data << " , write queue size: "
705
710
<< handle->stream .write_queue_size ;
706
711
data << (uv_is_readable (&handle->stream ) ? " , readable" : " " )
707
712
<< (uv_is_writable (&handle->stream ) ? " , writable" : " " );
0 commit comments