[pacman-dev] [PATCH 1/2] pacman: fix alignment when download eta > 1h
Morgan Adamiec
morganamilo at archlinux.org
Thu Jan 28 15:50:37 UTC 2021
On 28/01/2021 03:09, Allan McRae wrote:
> On 17/1/21 2:32 am, morganamilo wrote:
>> 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.
>> ---
>
> How about, we just display the time if it is less than 100 minutes? On
> any reasonable connection (even by Australian standards), the vast
> majority of packages should download within that timeframe. And times
> are not particularly accurate beyond that.
On my awful connection times going above an hour is common place. I see
it multiple times a week. However it never actually takes an hour to
download. Just my connection speed bounces up and down. So I guess
you're right when you say it's not accurate. Your call.
>
>> 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);
>> }
>>
More information about the pacman-dev
mailing list