MediaWiki master
Wikimedia\Telemetry\Clock Class Reference

A click providing the current time in nanoseconds, backed by hrtime. More...

Public Member Functions

 __construct ()
 
 getCurrentNanoTime ()
 Get the current time, represented as the number of nanoseconds since the UNIX epoch.
 

Static Public Member Functions

static setMockTime (?int $epochNanos)
 Set a mock time to override the timestamp returned by Clock::getCurrentNanoTime().
 

Detailed Description

A click providing the current time in nanoseconds, backed by hrtime.

Since
1.43
Access: internal

Definition at line 12 of file Clock.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Telemetry\Clock::__construct ( )

Definition at line 26 of file Clock.php.

Member Function Documentation

◆ getCurrentNanoTime()

Wikimedia\Telemetry\Clock::getCurrentNanoTime ( )

Get the current time, represented as the number of nanoseconds since the UNIX epoch.

Returns
int

Definition at line 37 of file Clock.php.

◆ setMockTime()

static Wikimedia\Telemetry\Clock::setMockTime ( ?int $epochNanos)
static

Set a mock time to override the timestamp returned by Clock::getCurrentNanoTime().

Useful for testing.

Parameters
int | null$epochNanosThe override timestamp, or null to return to using the current time.
Returns
void

Definition at line 49 of file Clock.php.


The documentation for this class was generated from the following file: