Calculate Remaining time

[b][red]This message was edited by porodoro at 2006-4-3 6:58:28[/red][/b][hr]
Hi , i need some help (again) !

I've got a form ,1 opendialog, 1 button , and 1 progressbar .

When the user clicks the button , opendialog opens . The user selects a file and extracts its size.

Progressbar1.min =0
progressbar1.max = file_Size

FUNCTION_COPY ()

Everything's fine here . Now im looking for a way to get the remaining copy time and display it on form's caption. Any idea ? (ps : the format must be in minutes! , and i need to use progressbar's value(min-max))

Thanks !


Comments

  • : [b][red]This message was edited by porodoro at 2006-4-3 6:58:28[/red][/b][hr]
    : Hi , i need some help (again) !
    :
    : I've got a form ,1 opendialog, 1 button , and 1 progressbar .
    :
    : When the user clicks the button , opendialog opens . The user selects a file and extracts its size.
    :
    : Progressbar1.min =0
    : progressbar1.max = file_Size
    :
    : FUNCTION_COPY ()
    :
    : Everything's fine here . Now im looking for a way to get the remaining copy time and display it on form's caption. Any idea ? (ps : the format must be in minutes! , and i need to use progressbar's value(min-max))
    :
    : Thanks !
    :
    :
    :
    By periodically getting the time, you can determine how long the process is running. Based on that number and the position of the scrollbar, you can calculate the time remaining.
  • : : [b][red]This message was edited by porodoro at 2006-4-3 6:58:28[/red][/b][hr]
    : : Hi , i need some help (again) !
    : :
    : : I've got a form ,1 opendialog, 1 button , and 1 progressbar .
    : :
    : : When the user clicks the button , opendialog opens . The user selects a file and extracts its size.
    : :
    : : Progressbar1.min =0
    : : progressbar1.max = file_Size
    : :
    : : FUNCTION_COPY ()
    : :
    : : Everything's fine here . Now im looking for a way to get the remaining copy time and display it on form's caption. Any idea ? (ps : the format must be in minutes! , and i need to use progressbar's value(min-max))
    : :
    : : Thanks !
    : :
    : :
    : :
    : By periodically getting the time, you can determine how long the process is running. Based on that number and the position of the scrollbar, you can calculate the time remaining.
    :
    And how can i write such a thing ? can you write an example ?
  • : : : [b][red]This message was edited by porodoro at 2006-4-3 6:58:28[/red][/b][hr]
    : : : Hi , i need some help (again) !
    : : :
    : : : I've got a form ,1 opendialog, 1 button , and 1 progressbar .
    : : :
    : : : When the user clicks the button , opendialog opens . The user selects a file and extracts its size.
    : : :
    : : : Progressbar1.min =0
    : : : progressbar1.max = file_Size
    : : :
    : : : FUNCTION_COPY ()
    : : :
    : : : Everything's fine here . Now im looking for a way to get the remaining copy time and display it on form's caption. Any idea ? (ps : the format must be in minutes! , and i need to use progressbar's value(min-max))
    : : :
    : : : Thanks !
    : : :
    : : :
    : : :
    : : By periodically getting the time, you can determine how long the process is running. Based on that number and the position of the scrollbar, you can calculate the time remaining.
    : :
    : And how can i write such a thing ? can you write an example ?
    :
    Here is a pseudo code to show the calculation:
    [code]
    Get Start Time;
    while some length process do
    begin
    if Progress > 5% then
    begin
    TimePassed := Now-StartTime;
    TimePerProgressUnit := (Position - Min)/(Max - Min);
    TimeRemaining := TimePerProgressUnit*(Max - Position);
    Show TimeRemaining
    end;
    end;
    [/code]
    What it does is this:

    Suppose this is what the progress looks like at a certain time:
    [code]
    --------|================
    [/code]
    First it calculates the time it took to move the cursor (|) from the start to the current position (i.e. the length of the ---- in time). From that it calculates the time per unit of the progressbar (i.e. the time of each individual dash (-)). Assuming that the length of each dash is the same as each "equals" (=), it calculates the length of time after the cursor by multiplying that "unit"-time by the length remaining.
  • : : : : [b][red]This message was edited by porodoro at 2006-4-3 6:58:28[/red][/b][hr]
    : : : : Hi , i need some help (again) !
    : : : :
    : : : : I've got a form ,1 opendialog, 1 button , and 1 progressbar .
    : : : :
    : : : : When the user clicks the button , opendialog opens . The user selects a file and extracts its size.
    : : : :
    : : : : Progressbar1.min =0
    : : : : progressbar1.max = file_Size
    : : : :
    : : : : FUNCTION_COPY ()
    : : : :
    : : : : Everything's fine here . Now im looking for a way to get the remaining copy time and display it on form's caption. Any idea ? (ps : the format must be in minutes! , and i need to use progressbar's value(min-max))
    : : : :
    : : : : Thanks !
    : : : :
    : : : :
    : : : :
    : : : By periodically getting the time, you can determine how long the process is running. Based on that number and the position of the scrollbar, you can calculate the time remaining.
    : : :
    : : And how can i write such a thing ? can you write an example ?
    : :
    : Here is a pseudo code to show the calculation:
    : [code]
    : Get Start Time;
    : while some length process do
    : begin
    : if Progress > 5% then
    : begin
    : TimePassed := Now-StartTime;
    : TimePerProgressUnit := (Position - Min)/(Max - Min);
    : TimeRemaining := TimePerProgressUnit*(Max - Position);
    : Show TimeRemaining
    : end;
    : end;
    : [/code]
    : What it does is this:
    :
    : Suppose this is what the progress looks like at a certain time:
    : [code]
    : --------|================
    : [/code]
    : First it calculates the time it took to move the cursor (|) from the start to the current position (i.e. the length of the ---- in time). From that it calculates the time per unit of the progressbar (i.e. the time of each individual dash (-)). Assuming that the length of each dash is the same as each "equals" (=), it calculates the length of time after the cursor by multiplying that "unit"-time by the length remaining.
    :
    Cool , thanks !
  • : : : : : [b][red]This message was edited by porodoro at 2006-4-3 6:58:28[/red][/b][hr]
    : : : : : Hi , i need some help (again) !
    : : : : :
    : : : : : I've got a form ,1 opendialog, 1 button , and 1 progressbar .
    : : : : :
    : : : : : When the user clicks the button , opendialog opens . The user selects a file and extracts its size.
    : : : : :
    : : : : : Progressbar1.min =0
    : : : : : progressbar1.max = file_Size
    : : : : :
    : : : : : FUNCTION_COPY ()
    : : : : :
    : : : : : Everything's fine here . Now im looking for a way to get the remaining copy time and display it on form's caption. Any idea ? (ps : the format must be in minutes! , and i need to use progressbar's value(min-max))
    : : : : :
    : : : : : Thanks !
    : : : : :
    : : : : :
    : : : : :
    : : : : By periodically getting the time, you can determine how long the process is running. Based on that number and the position of the scrollbar, you can calculate the time remaining.
    : : : :
    : : : And how can i write such a thing ? can you write an example ?
    : : :
    : : Here is a pseudo code to show the calculation:
    : : [code]
    : : Get Start Time;
    : : while some length process do
    : : begin
    : : if Progress > 5% then
    : : begin
    : : TimePassed := Now-StartTime;
    : : TimePerProgressUnit := (Position - Min)/(Max - Min);
    : : TimeRemaining := TimePerProgressUnit*(Max - Position);
    : : Show TimeRemaining
    : : end;
    : : end;
    : : [/code]
    : : What it does is this:
    : :
    : : Suppose this is what the progress looks like at a certain time:
    : : [code]
    : : --------|================
    : : [/code]
    : : First it calculates the time it took to move the cursor (|) from the start to the current position (i.e. the length of the ---- in time). From that it calculates the time per unit of the progressbar (i.e. the time of each individual dash (-)). Assuming that the length of each dash is the same as each "equals" (=), it calculates the length of time after the cursor by multiplying that "unit"-time by the length remaining.
    : :
    : Cool , thanks !
    :
    Well , theres a problem when im using GETTIME or TIME function! , it returns string (eg 11:11:05) , and ofcourse the calculation isnt right!.
    How can i fix this ?
  • : : : : : : [b][red]This message was edited by porodoro at 2006-4-3 6:58:28[/red][/b][hr]
    : : : : : : Hi , i need some help (again) !
    : : : : : :
    : : : : : : I've got a form ,1 opendialog, 1 button , and 1 progressbar .
    : : : : : :
    : : : : : : When the user clicks the button , opendialog opens . The user selects a file and extracts its size.
    : : : : : :
    : : : : : : Progressbar1.min =0
    : : : : : : progressbar1.max = file_Size
    : : : : : :
    : : : : : : FUNCTION_COPY ()
    : : : : : :
    : : : : : : Everything's fine here . Now im looking for a way to get the remaining copy time and display it on form's caption. Any idea ? (ps : the format must be in minutes! , and i need to use progressbar's value(min-max))
    : : : : : :
    : : : : : : Thanks !
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : By periodically getting the time, you can determine how long the process is running. Based on that number and the position of the scrollbar, you can calculate the time remaining.
    : : : : :
    : : : : And how can i write such a thing ? can you write an example ?
    : : : :
    : : : Here is a pseudo code to show the calculation:
    : : : [code]
    : : : Get Start Time;
    : : : while some length process do
    : : : begin
    : : : if Progress > 5% then
    : : : begin
    : : : TimePassed := Now-StartTime;
    : : : TimePerProgressUnit := (Position - Min)/(Max - Min);
    : : : TimeRemaining := TimePerProgressUnit*(Max - Position);
    : : : Show TimeRemaining
    : : : end;
    : : : end;
    : : : [/code]
    : : : What it does is this:
    : : :
    : : : Suppose this is what the progress looks like at a certain time:
    : : : [code]
    : : : --------|================
    : : : [/code]
    : : : First it calculates the time it took to move the cursor (|) from the start to the current position (i.e. the length of the ---- in time). From that it calculates the time per unit of the progressbar (i.e. the time of each individual dash (-)). Assuming that the length of each dash is the same as each "equals" (=), it calculates the length of time after the cursor by multiplying that "unit"-time by the length remaining.
    : : :
    : : Cool , thanks !
    : :
    : Well , theres a problem when im using GETTIME or TIME function! , it returns string (eg 11:11:05) , and ofcourse the calculation isnt right!.
    : How can i fix this ?
    :
    The calculation was indeed faulty. Here is a checked, and working one:
    [code]
    TimePerProgressUnit := TimeSpend/Progress;
    TimeRemaining := TimePerProgressUnit*(Max - Progress);
    [/code]
  • : : : : : : : [b][red]This message was edited by porodoro at 2006-4-3 6:58:28[/red][/b][hr]
    : : : : : : : Hi , i need some help (again) !
    : : : : : : :
    : : : : : : : I've got a form ,1 opendialog, 1 button , and 1 progressbar .
    : : : : : : :
    : : : : : : : When the user clicks the button , opendialog opens . The user selects a file and extracts its size.
    : : : : : : :
    : : : : : : : Progressbar1.min =0
    : : : : : : : progressbar1.max = file_Size
    : : : : : : :
    : : : : : : : FUNCTION_COPY ()
    : : : : : : :
    : : : : : : : Everything's fine here . Now im looking for a way to get the remaining copy time and display it on form's caption. Any idea ? (ps : the format must be in minutes! , and i need to use progressbar's value(min-max))
    : : : : : : :
    : : : : : : : Thanks !
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : By periodically getting the time, you can determine how long the process is running. Based on that number and the position of the scrollbar, you can calculate the time remaining.
    : : : : : :
    : : : : : And how can i write such a thing ? can you write an example ?
    : : : : :
    : : : : Here is a pseudo code to show the calculation:
    : : : : [code]
    : : : : Get Start Time;
    : : : : while some length process do
    : : : : begin
    : : : : if Progress > 5% then
    : : : : begin
    : : : : TimePassed := Now-StartTime;
    : : : : TimePerProgressUnit := (Position - Min)/(Max - Min);
    : : : : TimeRemaining := TimePerProgressUnit*(Max - Position);
    : : : : Show TimeRemaining
    : : : : end;
    : : : : end;
    : : : : [/code]
    : : : : What it does is this:
    : : : :
    : : : : Suppose this is what the progress looks like at a certain time:
    : : : : [code]
    : : : : --------|================
    : : : : [/code]
    : : : : First it calculates the time it took to move the cursor (|) from the start to the current position (i.e. the length of the ---- in time). From that it calculates the time per unit of the progressbar (i.e. the time of each individual dash (-)). Assuming that the length of each dash is the same as each "equals" (=), it calculates the length of time after the cursor by multiplying that "unit"-time by the length remaining.
    : : : :
    : : : Cool , thanks !
    : : :
    : : Well , theres a problem when im using GETTIME or TIME function! , it returns string (eg 11:11:05) , and ofcourse the calculation isnt right!.
    : : How can i fix this ?
    : :
    : The calculation was indeed faulty. Here is a checked, and working one:
    : [code]
    : TimePerProgressUnit := TimeSpend/Progress;
    : TimeRemaining := TimePerProgressUnit*(Max - Progress);
    : [/code]
    :
    Yeah !, it worked ! ,thanks..
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories