You are here

function progress_estimate_completion in Background Process 8

Estimate completion time of a progress.

2 calls to progress_estimate_completion()
BackgroundBatchContext::offsetSet in background_batch/src/BackgroundBatchContext.php
Implements to Update progress if needed.
DefaultController::backgroundBatchOverviewPage in background_batch/src/Controller/DefaultController.php
Implements Background Batch Overview Page.

File

progress/progress.module, line 160
Progress framework for keeping track of progresses. @todo Force MyISAM for table {progress} to avoid transaction/isolation level problems, and use INSERT DELAYED for performance.

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;
}