本文整理汇总了PHP中Mage_Index_Model_Process::getStartedAt方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Index_Model_Process::getStartedAt方法的具体用法?PHP Mage_Index_Model_Process::getStartedAt怎么用?PHP Mage_Index_Model_Process::getStartedAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Index_Model_Process
的用法示例。
在下文中一共展示了Mage_Index_Model_Process::getStartedAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDataFromProcess
/**
* Set start time and end time based on current process data
*
* @param Mage_Index_Model_Process $process
* @return $this
*/
public function setDataFromProcess(Mage_Index_Model_Process $process)
{
$startTime = new DateTime($process->getStartedAt());
$endTime = new DateTime($process->getEndedAt());
$runningTime = $endTime->getTimestamp() - $startTime->getTimestamp();
$this->setData(array('process_id' => $process->getId(), 'started_at' => $process->getStartedAt(), 'ended_at' => $process->getEndedAt(), 'running_time' => $runningTime));
return $this;
}
示例2: getProgress
public function getProgress(Mage_Index_Model_Process $process)
{
$avgTime = Mage::getModel('hackathon_indexerstats_resource/history')->getAvg($process->getId());
$currentTime = new DateTime();
$startTime = new DateTime($process->getStartedAt());
$estimatedEndTime = new DateTime($process->getStartedAt());
$estimatedEndTime->add(new DateInterval('PT' . $avgTime . 'S'));
$processDiff = $currentTime->getTimestamp() - $startTime->getTimestamp();
if ($avgTime == 0) {
return 1;
}
return $processDiff / $avgTime;
}