Starts the timer for measurement.

@param bool $includeWalltime TRUE to start timer including time from routing (absolute request time)

@author Benjamin Carl <opensource@clickalicious.de>
@static
498190
protected static function startTimer($includeWalltime = true)
    {
        // Include time from bootstrapping + routing?
        if ($includeWalltime) {
            self::$starttime = $_SERVER['REQUEST_TIME'];
        } else {
            self::$starttime = microtime(true);
        }
    }
1141649
public function stop_hook_timer() {
		if ( $this->hook_depth ) {
			$this->hook_depth--;
		} else {
			if ( ! is_null( $this->hook_start_time ) ) {
				$this->hook_time += microtime( true ) - $this->hook_start_time;
			}
			$this->hook_start_time = null;
		}
	}
177555
public function start($object): TimerInterface
    {
        $this->timer[spl_object_hash($object)] = microtime(true);

        return $this;
    }
139768
public function start_hook_timer() {
		$this->hook_count++;
		// Timer already running means a subhook has been called
		if ( ! is_null( $this->hook_start_time ) ) {
			$this->hook_depth++;
		} else {
			$this->hook_start_time = microtime( true );
		}
	}
674798
private void start(long time, String name){
		name = getName(name);
		TimerGroupItem timer = m_timers.get(name);
		if (timer == null){
			timer = new TimerGroupItem(name);
			m_timers.put(name, timer);
		}
		timer.start(time);
		m_total.start(time);
	}
1367733
private function setTimers($forceRegenerate = false)
    {
        $start = time();

        // If there is no starting point, restart all over again
        if (!$this->has('timer.start', 'session') || $forceRegenerate) {
            $this->set('timer.start', $start, 'session');
            $this->set('timer.last', $start, 'session');
            $this->set('timer.now', $start, 'session');
        }

        // Set current timers
        $this->set('timer.last', $this->get('timer.now', null, 'session'), 'session');
        $this->set('timer.now', time(), 'session');
    }
1079445
protected function setStarted($time = null)
    {
        $this->started = $time ?: microtime(true);
        $this->setState(RunInterface::STATE_RUNNING);
    }
1348688
public function timer($metric, $duration = null, array $tags = array(), $sampleRate = AbstractMetric::DEFAULT_SAMPLE_RATE)
    {
        return new Timer($this->prefix($metric), $duration, array_merge($this->defaultTags, $tags), $sampleRate);
    }
692876
function onTimer($timerId)
    {
        $now = time();
        //echo "timer $interval\n";
        foreach ($this->wait_requests as $id => $request)
        {
            if ($request->time < $now - $this->request_timeout)
            {
                $response = new Swoole\Response;
                $response->setHeader('Access-Control-Allow-Origin', $this->origin);
                $response->body = json_encode(array('success' => 0, 'text' => 'timeout'));
                $this->response($request, $response);
                unset($this->wait_requests[$id]);
            }
        }
    }
917875
public function enableTime(bool $time = true) : self
    {
        $this->set('data-fields--datetime-enable-time', var_export($time, true));

        return $this;
    }
333896
static public function start($name) {
    static::$timers[$name]['start'] = microtime(TRUE);
    static::$timers[$name]['count'] = isset(static::$timers[$name]['count']) ? ++static::$timers[$name]['count'] : 1;
  }
1174696
static function setScriptStart( $time = false )
    {
        if ( $time == false )
            $time = microtime( true );
        $debug = eZDebug::instance();
        $debug->ScriptStart = $time;
    }
327127
public function setUpdatedAt($time)
    {
        if ($time instanceof \DateTimeInterface) {
            $time = $time->format(DATE_RFC3339);
        }

        $this->setValue('lastModified', (string) $time);
    }
30274
private void startRoundTripMeasurement() {
        if (scheduler != null) {
            if (pingInterval > 0) {
                if (log.isDebugEnabled()) {
                    log.debug("startRoundTripMeasurement - {}", sessionId);
                }
                try {
                    // schedule with an initial delay of now + 2s to prevent ping messages during connect post processes
                    keepAliveTask = scheduler.scheduleWithFixedDelay(new KeepAliveTask(), new Date(System.currentTimeMillis() + 2000L), pingInterval);
                    if (log.isDebugEnabled()) {
                        log.debug("Keep alive scheduled for {}", sessionId);
                    }
                } catch (Exception e) {
                    log.error("Error creating keep alive job for {}", sessionId, e);
                }
            }
        } else {
            log.error("startRoundTripMeasurement cannot be executed due to missing scheduler. This can happen if a connection drops before handshake is complete");
        }
    }
1219479
protected function buildTimer(TimerInterface $metric, $timestamp)
    {
        $packet = $this->getBasePacket($metric, $timestamp);

        $packet .= $this->buildString(self::PART_TYPE_TYPE, 'gauge');
//        $packet .= $this->buildString(self::PART_TYPE_TYPE_INSTANCE, 1);

        $data = pack("nCd", 1, self::DATA_TYPE_GAUGE, $metric->getValue());

        $packet .= pack('nn', self::PART_TYPE_VALUES, strlen($data) + 4) . $data;

        return $packet;
    }
1220860
public void onSuccessfulWrite(long startTimeNanos) {
    Instrumented.updateTimer(this.dataWriterTimer, System.nanoTime() - startTimeNanos, TimeUnit.NANOSECONDS);
    Instrumented.markMeter(this.successfulWritesMeter);
  }
323426
public function start_timer() {
        global $USER, $DB;

        $cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
            false, MUST_EXIST);

        // Trigger lesson started event.
        $event = \mod_lesson\event\lesson_started::create(array(
            'objectid' => $this->properties()->id,
            'context' => context_module::instance($cm->id),
            'courseid' => $this->properties()->course
        ));
        $event->trigger();

        $USER->startlesson[$this->properties->id] = true;

        $timenow = time();
        $startlesson = new stdClass;
        $startlesson->lessonid = $this->properties->id;
        $startlesson->userid = $USER->id;
        $startlesson->starttime = $timenow;
        $startlesson->lessontime = $timenow;
        if (WS_SERVER) {
            $startlesson->timemodifiedoffline = $timenow;
        }
        $DB->insert_record('lesson_timer', $startlesson);
        if ($this->properties->timelimit) {
            $this->add_message(get_string('timelimitwarning', 'lesson', format_time($this->properties->timelimit)), 'center');
        }
        return true;
    }