Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/conmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,14 @@ int main(int argc, char *argv[])
}

if (opt_timeout > 0) {
g_timeout_add_seconds(opt_timeout, timeout_cb, NULL);
/*
* Do not use g_timeout_add_seconds here: it rounds the expiration
* to a whole second boundary, and may fire up to 250ms early.
*/
if ((guint)opt_timeout <= G_MAXUINT / 1000)
g_timeout_add((guint)opt_timeout * 1000, timeout_cb, NULL);
else /* Too long for g_timeout_add, imprecision does not matter. */
g_timeout_add_seconds(opt_timeout, timeout_cb, NULL);
}

if (data.exit_status_cache) {
Expand Down
Loading