You are here

function progress_estimate_completion in Progress 7

Same name and namespace in other branches
  1. 8 progress.module \progress_estimate_completion()
  2. 6 progress.module \progress_estimate_completion()

Estimate completion time of a progress

Parameters

object $progress: Progress object

Return value

double Estimated unix timestamp of completion in microseconds

File

./progress.module, line 211
Progress framework for keeping track of progresses

Code

function progress_estimate_completion($progress) {
  if ($progress->progress) {
    $progress->estimate = $progress->start + 1 / $progress->progress * ($progress->current - $progress->start);
  }
  else {
    $progress->estimate = NULL;
  }
  return $progress->estimate;
}