|
-
Jun 3rd, 2003, 12:36 PM
#1
Thread Starter
Addicted Member
Calculate Time Remaining
This isn't specifically a VB problem, but I'm sure someone here can answer it.
I need to estimate the time remaining for a process. The variables which I want to calculate it with are the completion ratio (0 - 1), and the time that has elapsed since the process began.
From this I should be able to calculate how many more seconds remain, right? Well I don't know the maths of it, so can anyone help me out?
Using Visual Studio .NET 2005
-
Jun 3rd, 2003, 12:44 PM
#2
PowerPoster
Re: Calculate Time Remaining
Originally posted by Barguast
This isn't specifically a VB problem, but I'm sure someone here can answer it.
I need to estimate the time remaining for a process. The variables which I want to calculate it with are the completion ratio (0 - 1), and the time that has elapsed since the process began.
From this I should be able to calculate how many more seconds remain, right? Well I don't know the maths of it, so can anyone help me out?
well the question is sufficiently vague 
If you are looping i = 1 to 1000 you could calculate percent complete as i/1000 and use the system time to track seconds/minutes/etc
That what you mean?
-
Jun 3rd, 2003, 12:50 PM
#3
Thread Starter
Addicted Member
I need it for a file encryptor. Let's say that the encryptor is 80% complete, then the ratio would be 0.8. If this was done in 16 seconds, then you can work out that the encryption will be complete in about 4 seconds.
I just can't seem to work out how the convert the above into an equation.
Using Visual Studio .NET 2005
-
Jun 3rd, 2003, 12:58 PM
#4
PowerPoster
Originally posted by Barguast
I need it for a file encryptor. Let's say that the encryptor is 80% complete, then the ratio would be 0.8. If this was done in 16 seconds, then you can work out that the encryption will be complete in about 4 seconds.
I just can't seem to work out how the convert the above into an equation.
(Now - StartTime) / PercentComplete
Thats the psuedo code anyway ... If you are using VB6 youd use DateDiff with Now and StartTime as arguments ...
-
Jun 3rd, 2003, 01:01 PM
#5
Thread Starter
Addicted Member
A-ha, that calculates the total time the process will take. I can work from that, thanks
Using Visual Studio .NET 2005
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|