[pacman-dev] [PATCH 1/2] pacman: fix alignment when download eta > 1h

morganamilo morganamilo at archlinux.org
Sat Jan 16 16:32:16 UTC 2021


When the download estimate is over an hour the format displayed changes
from mm:ss to hh:mm:ss. This causes everything to be out of alignment
die to the extra characters.

So intead, when the estimate is over an our change to the format 4h33m.

Do note that before pacman would display --:-- as the estimate if the
download was >= 100 hours. Now this is displayed if the downlaod is =>
10 hours.
---
 src/pacman/callback.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 7468ed7e..279338e7 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -865,8 +865,8 @@ static void draw_pacman_progress_bar(struct pacman_progress_bar *bar)
 	}
 	if(eta_h == 0) {
 		printf("%02u:%02u", eta_m, eta_s);
-	} else if(eta_h < 100) {
-		printf("%02u:%02u:%02u", eta_h, eta_m, eta_s);
+	} else if(eta_h < 10) {
+		printf("%01uh%02um", eta_h, eta_m);
 	} else {
 		fputs("--:--", stdout);
 	}
-- 
2.30.0


More information about the pacman-dev mailing list