From 5216754b1ecefbf7ae0f8c1f41f5522bcdfbd517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Thomas?= Date: Thu, 2 Feb 2017 17:55:39 +0000 Subject: [PATCH] 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 --- clients/nm-online.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/nm-online.c b/clients/nm-online.c index 8ad52e9e97..bb7da015c3 100644 --- a/clients/nm-online.c +++ b/clients/nm-online.c @@ -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);