File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 55#include "debug_utils.h"
66#include "util.h"
77#include <algorithm>
8+ #include <cmath>
89#include <memory>
910
1011namespace node {
@@ -126,8 +127,7 @@ class WorkerThreadsTaskRunner::DelayedTaskScheduler {
126127 delay_in_seconds_(delay_in_seconds) {}
127128
128129 void Run() override {
129- uint64_t delay_millis =
130- static_cast<uint64_t>(delay_in_seconds_ + 0.5) * 1000;
130+ uint64_t delay_millis = llround(delay_in_seconds_ * 1000);
131131 std::unique_ptr<uv_timer_t> timer(new uv_timer_t());
132132 CHECK_EQ(0, uv_timer_init(&scheduler_->loop_, timer.get()));
133133 timer->data = task_.release();
@@ -378,8 +378,8 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() {
378378 while (std::unique_ptr<DelayedTask> delayed =
379379 foreground_delayed_tasks_.Pop()) {
380380 did_work = true;
381- uint64_t delay_millis =
382- static_cast<uint64_t>(delayed->timeout + 0.5) * 1000;
381+ uint64_t delay_millis = llround(delayed->timeout * 1000);
382+
383383 delayed->timer.data = static_cast<void*>(delayed.get());
384384 uv_timer_init(loop_, &delayed->timer);
385385 // Timers may not guarantee queue ordering of events with the same delay if
You can’t perform that action at this time.
0 commit comments