nm-online: fix countdown to not show 0 seconds until finished

When using nm-online -t N, the countdown shows "0s" during the last second.

The countdown value should be rounded up so that "0s" is only shown when the
timeout is actually elapsed.

https://bugzilla.gnome.org/show_bug.cgi?id=778093
This commit is contained in:
Mickaël Thomas 2017-02-02 17:55:39 +00:00 committed by Thomas Haller
parent 660bb1a48f
commit 5216754b1e

View file

@ -90,7 +90,7 @@ _print_progress (int progress_next_step_i, gint64 remaining_ms, int success)
g_print ("\r%s", _("Connecting"));
for (i = 0; i < PROGRESS_STEPS; i++)
putchar (i < j ? '.' : ' ');
g_print (" %4lds", (long) (MAX (0, remaining_ms) / 1000));
g_print (" %4lds", (long) (MAX (0, remaining_ms + 999) / 1000));
if (success >= 0)
g_print (" [%sline]\n", success ? "on" : "off");
fflush (stdout);