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

Breadcrumb

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

class TestClock

@internal OpenTelemetry

Hierarchy

  • class \OpenTelemetry\API\Common\Time\TestClock implements \OpenTelemetry\API\Common\Time\ClockInterface

Expanded class hierarchy of TestClock

File

vendor/open-telemetry/api/Common/Time/TestClock.php, line 10

Namespace

OpenTelemetry\API\Common\Time
View source
final class TestClock implements ClockInterface {
    public const DEFAULT_START_EPOCH = 1633060331386955008;
    // Fri Oct 01 2021 03:52:11 UTC
    private int $currentEpochNanos;
    public function __construct(int $currentEpochNanos = self::DEFAULT_START_EPOCH) {
        $this->currentEpochNanos = $currentEpochNanos;
    }
    public function advanceSeconds(int $seconds = 1) : void {
        $this->advance($seconds * ClockInterface::NANOS_PER_SECOND);
    }
    public function advance(int $nanoSeconds = 1) : void {
        $this->currentEpochNanos += $nanoSeconds;
    }
    public function setTime(int $nanoSeconds) : void {
        $this->currentEpochNanos = $nanoSeconds;
    }
    public function now() : int {
        return $this->currentEpochNanos;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
ClockInterface::NANOS_PER_MICROSECOND public constant
ClockInterface::NANOS_PER_MILLISECOND public constant
ClockInterface::NANOS_PER_SECOND public constant
TestClock::$currentEpochNanos private property
TestClock::advance public function
TestClock::advanceSeconds public function
TestClock::DEFAULT_START_EPOCH public constant
TestClock::now public function Returns the current epoch wall-clock timestamp in nanoseconds Overrides ClockInterface::now
TestClock::setTime public function
TestClock::__construct public function

API Navigation

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