1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-04 16:53:14 +02:00

xfer: compute speed and ETA with microsecond precision

This commit is contained in:
Andrew Potter
2016-01-23 01:02:07 -08:00
committed by Sébastien Helleu
parent ca22e49041
commit 15e2da3aac
6 changed files with 66 additions and 37 deletions
+17 -6
View File
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include "../weechat-plugin.h"
#include "xfer.h"
@@ -217,12 +218,22 @@ xfer_buffer_refresh (const char *hotlist)
eta[0] = '\0';
if (ptr_xfer->status == XFER_STATUS_ACTIVE)
{
snprintf (eta, sizeof (eta),
"%s: %.2llu:%.2llu:%.2llu - ",
_("ETA"),
ptr_xfer->eta / 3600,
(ptr_xfer->eta / 60) % 60,
ptr_xfer->eta % 60);
if (ptr_xfer->eta != ULLONG_MAX)
{
snprintf (eta, sizeof (eta),
"%s: %.2llu:%.2llu:%.2llu - ",
_("ETA"),
ptr_xfer->eta / 3600,
(ptr_xfer->eta / 60) % 60,
ptr_xfer->eta % 60);
}
else
{
snprintf (eta, sizeof (eta),
"%s: %s - ",
_("ETA"),
_("unknown"));
}
}
/* display second line for file with status, progress bar and estimated time */