Skip to content

Commit

Permalink
src: apply clang-tidy rule bugprone-incorrect-roundings
Browse files Browse the repository at this point in the history
PR-URL: #26885
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Signed-off-by: Beth Griggs <[email protected]>
  • Loading branch information
gengjiawen authored and BethGriggs committed Apr 9, 2019
1 parent 247700f commit c537daf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "debug_utils.h"
#include "util.h"
#include <algorithm>
#include <cmath>
#include <memory>

namespace node {
Expand Down Expand Up @@ -126,8 +127,7 @@ class WorkerThreadsTaskRunner::DelayedTaskScheduler {
delay_in_seconds_(delay_in_seconds) {}

void Run() override {
uint64_t delay_millis =
static_cast<uint64_t>(delay_in_seconds_ + 0.5) * 1000;
uint64_t delay_millis = llround(delay_in_seconds_ * 1000);
std::unique_ptr<uv_timer_t> timer(new uv_timer_t());
CHECK_EQ(0, uv_timer_init(&scheduler_->loop_, timer.get()));
timer->data = task_.release();
Expand Down Expand Up @@ -378,8 +378,8 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() {
while (std::unique_ptr<DelayedTask> delayed =
foreground_delayed_tasks_.Pop()) {
did_work = true;
uint64_t delay_millis =
static_cast<uint64_t>(delayed->timeout + 0.5) * 1000;
uint64_t delay_millis = llround(delayed->timeout * 1000);

delayed->timer.data = static_cast<void*>(delayed.get());
uv_timer_init(loop_, &delayed->timer);
// Timers may not guarantee queue ordering of events with the same delay if
Expand Down

0 comments on commit c537daf

Please sign in to comment.