Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Time.php

function Time::getRequestMicroTime

Overrides TimeInterface::getRequestMicroTime

File

core/lib/Drupal/Component/Datetime/Time.php, line 54

Class

Time
Provides a class for obtaining system time.

Namespace

Drupal\Component\Datetime

Code

public function getRequestMicroTime() {
    $request = $this->requestStack ? $this->requestStack
        ->getCurrentRequest() : NULL;
    if ($request) {
        return $request->server
            ->get('REQUEST_TIME_FLOAT');
    }
    // If this is called prior to the request being pushed to the stack fallback
    // to built-in globals (if available) or the system time.
    return $_SERVER['REQUEST_TIME_FLOAT'] ?? $this->getProxyRequestMicroTime();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal