Skip to content

Commit

Permalink
Do ceil(timeout/1000) when convert us timestamp to libuv timestamp.
Browse files Browse the repository at this point in the history
  • Loading branch information
wengxt committed Nov 18, 2024
1 parent ed335d8 commit 5e48134
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/fcitx-utils/event_libuv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ bool LibUVSourceTime::setup(uv_loop_t *loop, uv_timer_t *timer) {
}
auto curr = now(clock_);
uint64_t timeout = time_ > curr ? (time_ - curr) : 0;
// libuv is milliseconds
timeout /= 1000;
// libuv is milliseconds, ceil towards 1ms.
timeout = timeout / 1000 + (timeout % 1000 != 0);
if (int err = uv_timer_start(timer, &TimeEventCallback, timeout, 0);
err < 0) {
FCITX_LIBUV_DEBUG() << "Failed to start timer with error: " << err;
Expand Down

0 comments on commit 5e48134

Please sign in to comment.