mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-15 20:25:18 +02:00
Add support for processing rate when total number is not available
This commit is contained in:
parent
25f76c2d3b
commit
78739fd442
|
@ -213,12 +213,12 @@ public:
|
||||||
// Calculate ETA if total number of progress available
|
// Calculate ETA if total number of progress available
|
||||||
// rate format: ETA XX:XX:XX
|
// rate format: ETA XX:XX:XX
|
||||||
// rate format: XXX items/sec
|
// rate format: XXX items/sec
|
||||||
if (!completed && index > 0 && total > 0) {
|
if (!completed && index > 0) {
|
||||||
Duration collectedTime = last_update_time - start_time;
|
Duration collectedTime = last_update_time - start_time;
|
||||||
float sec_per_item = 1.0 * collectedTime.total!"msecs" / index;
|
float msec_per_item = 1.0 * collectedTime.total!"msecs" / index;
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
// Calculate ETA if total number of progress available
|
// Calculate ETA if total number of progress available
|
||||||
long expected = to!long(sec_per_item * (total - index));
|
long expected = to!long(msec_per_item * (total - index));
|
||||||
long eta = expected + collectedTime.total!"msecs" - elapsed.total!"msecs";
|
long eta = expected + collectedTime.total!"msecs" - elapsed.total!"msecs";
|
||||||
if (eta < 0)
|
if (eta < 0)
|
||||||
eta = 1000;
|
eta = 1000;
|
||||||
|
@ -226,8 +226,8 @@ public:
|
||||||
rate = format("ETA %02d:%02d:%02d", h, m, s);
|
rate = format("ETA %02d:%02d:%02d", h, m, s);
|
||||||
} else {
|
} else {
|
||||||
// Calculate processing rate if total number of progress not available
|
// Calculate processing rate if total number of progress not available
|
||||||
float items_per_sec = 1.0 / sec_per_item;
|
float items_per_sec = 1.0 / msec_per_item * 1000;
|
||||||
rate = format("%02 items/sec", items_per_sec);
|
rate = format("%0.2f items/sec", items_per_sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue