… | |
… | |
538 | { |
538 | { |
539 | block = MAX_BLOCKTIME; |
539 | block = MAX_BLOCKTIME; |
540 | |
540 | |
541 | if (timercnt) |
541 | if (timercnt) |
542 | { |
542 | { |
543 | ev_tstamp to = timers [0]->at - get_clock () + method_fudge; |
543 | ev_tstamp to = timers [0]->at - (have_monotonic ? get_clock () : ev_now) + method_fudge; |
544 | if (block > to) block = to; |
544 | if (block > to) block = to; |
545 | } |
545 | } |
546 | |
546 | |
547 | if (periodiccnt) |
547 | if (periodiccnt) |
548 | { |
548 | { |
… | |
… | |
677 | { |
677 | { |
678 | timers [w->active - 1] = timers [timercnt]; |
678 | timers [w->active - 1] = timers [timercnt]; |
679 | downheap ((WT *)timers, timercnt, w->active - 1); |
679 | downheap ((WT *)timers, timercnt, w->active - 1); |
680 | } |
680 | } |
681 | |
681 | |
|
|
682 | w->at = w->repeat; |
|
|
683 | |
682 | ev_stop ((W)w); |
684 | ev_stop ((W)w); |
|
|
685 | } |
|
|
686 | |
|
|
687 | void |
|
|
688 | evtimer_again (struct ev_timer *w) |
|
|
689 | { |
|
|
690 | if (ev_is_active (w)) |
|
|
691 | { |
|
|
692 | if (w->repeat) |
|
|
693 | { |
|
|
694 | w->at = now + w->repeat; |
|
|
695 | downheap ((WT *)timers, timercnt, w->active - 1); |
|
|
696 | } |
|
|
697 | else |
|
|
698 | evtimer_stop (w); |
|
|
699 | } |
|
|
700 | else if (w->repeat) |
|
|
701 | evtimer_start (w); |
683 | } |
702 | } |
684 | |
703 | |
685 | void |
704 | void |
686 | evperiodic_start (struct ev_periodic *w) |
705 | evperiodic_start (struct ev_periodic *w) |
687 | { |
706 | { |