Home > Archive > Visual FoxPro SQL Queries > February 2006 > Time to the end









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Time to the end
Dawid.Federowicz@gmail.com

2006-01-20, 7:24 am

Hello,

Have you any idea, what should I do, when I want to create a procedure
which show me estimated time to the end of currently task?

I have a big & complicated query. It works about few hours, but I want
know, how many hours/minutes/seconds to the end.

(I know, it'll be only a gadget...)

Have you eny idea, how can I make this in VFP 6.0?

Regards,
Dawid

Lee Mitchell

2006-01-20, 11:24 am

Hi Dawid:

This code does not show estimated time, but it does place a progress bar on
the screen. It least you user will not think the process is hung.

259296 How to display a progress bar in the status bar in Visual FoxPro 9.0
and earlier versions
http://support.microsoft.com/defaul...kb;EN-US;259296

I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP9 HAS ARRIVED!! --*
Read about all the new features of VFP9 here:
http://msdn.microsoft.com/vfoxpro/

*--Purchase VFP 9.0 here:
http://www.microsoft.com/PRODUCTS/i...cid=54787e64-52
69-4500-8bf2-3f06689f4ab3&type=ovr

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/gp/lifeselectindex
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003


>Hello,


>Have you any idea, what should I do, when I want to create a procedure
>which show me estimated time to the end of currently task?


>I have a big & complicated query. It works about few hours, but I want
>know, how many hours/minutes/seconds to the end.


>(I know, it'll be only a gadget...)


>Have you eny idea, how can I make this in VFP 6.0?


>Regards,
>Dawid




Bryan Palmer

2006-02-20, 11:24 am

The way I do it is similar to the progress bar, but with something added.

First, at the start of the process, I get assign a current time to a var.
Then each iteration when the progress bar fires, I calculate the number of
elapsed seconds since the start, and divide that by the current percentage
completed, and subtract the current elapsed time. That will yield an
estimated number of seconds remaining. Typically for large processes
involving thousands of records, I just process my progressbar and time
estimate routine every 50-100 records.

Hope this helps!

Bryan Palmer



"Lee Mitchell" <Leemi@online.microsoft.com> wrote in message
news:I%237qJ0dHGHA.3944@TK2MSFTNGXA02.phx.gbl...
> Hi Dawid:
>
> This code does not show estimated time, but it does place a progress bar
> on
> the screen. It least you user will not think the process is hung.
>
> 259296 How to display a progress bar in the status bar in Visual FoxPro
> 9.0
> and earlier versions
> http://support.microsoft.com/defaul...kb;EN-US;259296
>
> I hope this helps.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> Sincerely,
> Microsoft FoxPro Technical Support
> Lee Mitchell
>
> *-- VFP9 HAS ARRIVED!! --*
> Read about all the new features of VFP9 here:
> http://msdn.microsoft.com/vfoxpro/
>
> *--Purchase VFP 9.0 here:
> http://www.microsoft.com/PRODUCTS/i...cid=54787e64-52
> 69-4500-8bf2-3f06689f4ab3&type=ovr
>
> Keep an eye on the product lifecycle for Visual FoxPro here:
> http://support.microsoft.com/gp/lifeselectindex
> - VFP5 Mainstream Support retired June 30th, 2003
> - VFP6 Mainstream Support retired Sept. 30th, 2003
>
>
>
>
>
>
>
>
>
>



Bryan Palmer

2006-02-20, 8:25 pm

In production code you'd need to add in a check to make an allowance for the
process going over the midnight mark, and there's probably a more efficient
way of calculating the hours/minutes/seconds figures from the estimated
total seconds left, but this should be enough to get you going.

LOCAL lnElapsed, lnStartTime, lnEstimatedLeft, lnHoursLeft, lnMinutesLeft,
lnSecondsLeft, lnPercentDone
LOCAL lnMaxCount
m.lnMaxCount = 250
CLEAR
? "Starting Loop"
lnStartTime = SECONDS()
FOR lnLoop = 1 TO m.lnMaxCount
INKEY(.3) && simulate progress bar being updated 3 times a second
m.lnPercentDone = (m.lnLoop / m.lnMaxCount) * 100
m.lnElapsed = SECONDS() - m.lnStartTime
m.lnEstimatedLeft = ( m.lnElapsed / (m.lnPercentDone/100) ) - m.lnElapsed
m.lnHoursLeft = INT(m.lnEstimatedLeft / 3600)
m.lnMinutesLeft = INT((m.lnEstimatedLeft - (m.lnHoursLeft*3600))/60)
m.lnSecondsLeft = INT(m.lnEstimatedLeft - (m.lnHoursLeft*3600) -
(m.lnMinutesLeft*60))
&& This would be a good place to update progressbar
?
m.lnPercentDone,m.lnElapsed,m.lnEstimatedLeft,m.lnHoursLeft,m.lnMinutesLeft,m.lnSecondsLeft
NEXT

- Bryan



"Lee Mitchell" <Leemi@online.microsoft.com> wrote in message
news:I%237qJ0dHGHA.3944@TK2MSFTNGXA02.phx.gbl...
> Hi Dawid:
>
> This code does not show estimated time, but it does place a progress bar
> on
> the screen. It least you user will not think the process is hung.
>
> 259296 How to display a progress bar in the status bar in Visual FoxPro
> 9.0
> and earlier versions
> http://support.microsoft.com/defaul...kb;EN-US;259296
>
> I hope this helps.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> Sincerely,
> Microsoft FoxPro Technical Support
> Lee Mitchell
>
> *-- VFP9 HAS ARRIVED!! --*
> Read about all the new features of VFP9 here:
> http://msdn.microsoft.com/vfoxpro/
>
> *--Purchase VFP 9.0 here:
> http://www.microsoft.com/PRODUCTS/i...cid=54787e64-52
> 69-4500-8bf2-3f06689f4ab3&type=ovr
>
> Keep an eye on the product lifecycle for Visual FoxPro here:
> http://support.microsoft.com/gp/lifeselectindex
> - VFP5 Mainstream Support retired June 30th, 2003
> - VFP6 Mainstream Support retired Sept. 30th, 2003
>
>
>
>
>
>
>
>
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com