ActionScheduler_Abstract_QueueRunner::get_execution_time()protectedWC 1.0

Get the number of seconds the process has been running.

Метод класса: ActionScheduler_Abstract_QueueRunner{}

Хуки из метода

Возвращает

int. The number of seconds.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_execution_time();

Код ActionScheduler_Abstract_QueueRunner::get_execution_time() WC 9.3.3

protected function get_execution_time() {
	$execution_time = microtime( true ) - $this->created_time;

	// Get the CPU time if the hosting environment uses it rather than wall-clock time to calculate a process's execution time.
	if ( function_exists( 'getrusage' ) && apply_filters( 'action_scheduler_use_cpu_execution_time', defined( 'PANTHEON_ENVIRONMENT' ) ) ) {
		$resource_usages = getrusage();

		if ( isset( $resource_usages['ru_stime.tv_usec'], $resource_usages['ru_stime.tv_usec'] ) ) {
			$execution_time = $resource_usages['ru_stime.tv_sec'] + ( $resource_usages['ru_stime.tv_usec'] / 1000000 );
		}
	}

	return $execution_time;
}