return byps;
}
+static const char *eta_fmt(int s) {
+ static char tbuf[10];
+ int h, m, n = 0;
+ h = s / 3600;
+ m = (s / 60) % 60;
+ s = s % 60;
+ if ( h )
+ n = snprintf(tbuf, sizeof tbuf, "%02d:", h);
+ snprintf(tbuf + n, sizeof tbuf - n, "%02d:%02d", m, s);
+ return tbuf;
+}
+
static uint64_t time_ms( void ) {
struct timespec tv;
clock_gettime( CLOCK_REALTIME, &tv );
starttime = time_ms();
while ( fi.remn ) {
+ int eta;
if ( gotsig ) {
res = -1;
break;
if ( CSIZE_HARDLIMIT < csize )
csize = CSIZE_HARDLIMIT;
fprintf( stderr, "\r%3.f%% (%5.1f KiB/s) ", (double)fi.coff * 100 / fi.size, (double)fi.speed / 1024 );
+ eta = (double)fi.remn / (fi.speed ? fi.speed : 1);
+ fprintf( stderr, " ETA: %s ", eta_fmt(eta));
// fprintf( stderr, "[csize: %ld] {offset: %ld} ", (long)csize, (long)fi.coff );
fflush( stderr );
}