upload file and estimation time

Diez B. Roggisch deets at nospam.web.de
Sat Jan 12 08:18:32 EST 2008


whatazor schrieb:
> Hi all,
> unseccsefully, I try to analyze this problem. If I can only work on
> the client size, how can I create a module that calculate the upload
> time of a file, so the time for finish it? i can start with ftp
> protocol and after extend this logic for my requirements.

All you need to to is to

  - count the number of bytes to transfer, U

  - count the bytes already transfered, u

  - measure the time since the upload, t



Then the ETA is

eta = (u / t) * (U - u)

Using the ftp-lib, you best pass a file-wrapper that overload the 
read-method to accumulate the read bytes to yield u.

Diez



More information about the Python-list mailing list