You are here

public function TimestampInvalidatorBase::getCurrentTimestamp in Memcache API and Integration 8.2

Get the current timestamp, optionally offset by a number.

The standard granularity of the resulting timestamp is three decimal places, (1 millisecond).

Parameters

float $offset: Offset to apply to timestamp before rounding.

Return value

float Current timestamp in decimal seconds.

Overrides TimestampInvalidatorInterface::getCurrentTimestamp

1 call to TimestampInvalidatorBase::getCurrentTimestamp()
TimestampInvalidatorBase::markAsOutdated in src/Invalidator/TimestampInvalidatorBase.php
Mark a tag as outdated.

File

src/Invalidator/TimestampInvalidatorBase.php, line 55

Class

TimestampInvalidatorBase
Class TimestampInvalidatorBase.

Namespace

Drupal\memcache\Invalidator

Code

public function getCurrentTimestamp($offset = 0.0) {

  // @todo Eventually we might want to use a time service instead of microtime().
  // Unfortunately, TimeInterface needs a request object and we don't have
  // that in the bootstrap container.
  return round(microtime(TRUE) + $offset, 3);
}