本文整理汇总了PHP中DateTimeUtil::get_ElaspedSeconds方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::get_ElaspedSeconds方法的具体用法?PHP DateTimeUtil::get_ElaspedSeconds怎么用?PHP DateTimeUtil::get_ElaspedSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtil
的用法示例。
在下文中一共展示了DateTimeUtil::get_ElaspedSeconds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($result->fetchAll() as $job) {
// Job level description
$job['joblevel'] = $joblevel[$job['level']];
// Job execution execution time
$job['elapsedtime'] = DateTimeUtil::Get_Elapsed_Time($job['starttime'], $job['endtime']);
// Compression
if ($job['jobbytes'] > 0) {
$compression = 1 - $job['jobbytes'] / $job['readbytes'];
$job['compression'] = number_format($compression, 2);
} else {
$job['compression'] = 'N/A';
}
// Job speed
$start = $job['starttime'];
$end = $job['endtime'];
$seconds = DateTimeUtil::get_ElaspedSeconds($end, $start);
if ($seconds !== false && $seconds > 0) {
$speed = $job['jobbytes'] / $seconds;
$job['speed'] = CUtils::Get_Human_Size($speed, 2) . '/s';
} else {
$job['speed'] = 'N/A';
}
// Job bytes more easy to read
$job['jobbytes'] = CUtils::Get_Human_Size($job['jobbytes']);
$job['jobfiles'] = CUtils::format_Number($job['jobfiles']);
$jobs[] = $job;
}
// end while
} catch (Exception $e) {
CErrorHandler::displayError($e);
}
示例2: switch
// Get the job elapsed time completion
$job['elapsed_time'] = DateTimeUtil::Get_Elapsed_Time($start_time, $end_time);
// Job Level
$job['level'] = $job_levels[$job['level']];
// Job files
$job['jobfiles'] = CUtils::format_Number($job['jobfiles']);
// Set default Job speed and compression rate
$job['speed'] = '0 Mb/s';
$job['compression'] = 'n/a';
switch ($job['jobstatus']) {
case J_COMPLETED:
case J_COMPLETED_ERROR:
case J_NO_FATAL_ERROR:
case J_CANCELED:
// Job speed
$seconds = DateTimeUtil::get_ElaspedSeconds($end_time, $start_time);
if ($seconds !== false && $seconds > 0) {
$speed = $job['jobbytes'] / $seconds;
$speed = CUtils::Get_Human_Size($speed, 2) . '/s';
$job['speed'] = $speed;
} else {
$job['speed'] = 'n/a';
}
// Job compression
if ($job['jobbytes'] > 0 && $job['type'] == 'B') {
$compression = 1 - $job['jobbytes'] / $job['readbytes'];
$job['compression'] = number_format($compression, 2);
} else {
$job['compression'] = 'n/a';
}
break;