A: 

Most of all I would never display seconds (only hours and minutes). I think it's really frustrating when you sit there and wait for a minute while the timer jumps between 10 and 20 seconds. And always display real information like: xxx/yyyy MB copied.

I would also include something like this:

if timeLeft > 5h --> Inform user that this might not work properly
if timeLeft > 10h --> Inform user that there might be better ways to move the file
if timeLeft > 24h --> Abort and check for problems

I would also inform the user if the estimated time varies too much

And if it's not too complicated, there should be an auto-check function that checks if the process is still alive and working properly every 1-10 minutes (depending on the application).

Chris
What happens then if you're copying say, 100GB of videos? it doesn't happen much but it *can* happen...
RCIX
A: 

speaking about network file copy, the best thing is to calculate file size to be transfered, network response and etc. An approach that i used once was:

Connection speed = Ping and calculate the round trip time for packages with 15 Kbytes.

Get my file size and see, theorically, how many time it would take if i would break it in 15 kb packages using my connection speed.

Recalculate my connection speed after transfer is started and ajust the time that will be spended.

VP
+1  A: 

I've done something similar to estimate when a queue will be empty, given that items are being dequeued faster than they are being enqueued. I used linear regression over the most recent N readings of (time,queue size).

This gives better results than a naive

(bytes_copied_so_far / elapsed_time) * bytes_left_to_copy
Matt Howells
+1  A: 
  • Start a global timer that fires say, every 1000 milliseconds and update a total elpased time counter. Let's call this variable "elapsedTime"
  • While the file is being copied, update some local variable with the amount already copied. Let's call this variable "totalCopied"
  • In the timer event that is periodically raised, divide totalCopied by totalElapsed to give the number of bytes copied per timer interval (in this case, 1000ms). Let's call this variable "bytesPerSec"
  • Divide the total file size by bytesPerSec and obtain the total number of seconds theoretically required to copy this file. Let's call this variable remainingTime
  • Subtract elapsedTime from remainingTime and you a somewhat accurate calculation for file copy time.
Mike J
+2  A: 

Have a look at my answer to a similar question (and the other answers there) on how the remaining time is estimated in Windows Explorer.

In my opinion, there is only one way to get good estimates:

  • Calculate the exact number of bytes to be copied before you begin the copy process
  • Recalculate you estimate regularly (every 1, 5 or 10 seconds, YMMV) based on the current transfer speed
  • The current transfer speed can fluctuate heavily when you are copying on a network, so use an average, for example based on the amount of bytes transfered since your last estimate.

Note that the first point may require quite some work, if you are copying many files. That is probably why the guys from Microsoft decided to go without it. You need to decide yourself if the additional overhead created by that calculation is worth giving your user a better estimate.

Treb
+1 for using a sliding window.
RichieHindle
+1  A: 

I think dialogs should just admit their limitations. It's not annoying because it's failing to give a useful time estimate, it's annoying because it's authoritatively offering an estimate that's obvious nonsense.

So, estimate however you like, based on current rate or average rate so far, rolling averages discarding outliers, or whatever. Depends on the operation and the typical durations of events which delay it, so you might have different algorithms when you know the file copy involves a network drive. But until your estimate has been fairly consistent for a period of time equal to the lesser of 30 seconds or 10% of the estimated time, display "oh dear, there seems to be some kind of holdup" when it's massively slowed, or just ignore it if it's massively sped up.

For example, dialog messages taken at 1-second intervals when a connection briefly stalls:

remaining: 60 seconds               // estimate is 60 seconds
remaining: 59 seconds               // estimate is 59 seconds
remaining: delayed [was 59 seconds] // estimate is 12 hours
remaining: delayed [was 59 seconds] // estimate is infinity
remaining: delayed [was 59 seconds] // got data: estimate is 59 seconds
// six seconds later
remaining: 53 seconds               // estimate is 53 seconds
Steve Jessop