ActionScheduler_Abstract_QueueRunner::get_execution_time()protectedWC 1.0

Get the number of seconds the process has been running.

Method of the class: ActionScheduler_Abstract_QueueRunner{}

Return

Int. The number of seconds.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_execution_time();

ActionScheduler_Abstract_QueueRunner::get_execution_time() code WC 8.6.1

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