class FixedTimeProvider implements TimeProviderInterface (View source)

FixedTimeProvider uses an previously-generated timestamp to provide the time

This provider allows the use of a previously-generated timestamp, such as one stored in a database, when creating version 1 UUIDs.

Methods

__construct(array $timestamp)

Constructs a FixedTimeProvider using the provided $timestamp

setUsec(int $value)

Sets the usec component of the timestamp

setSec(int $value)

Sets the sec component of the timestamp

int[]
currentTime()

Returns a timestamp array

Details

__construct(array $timestamp)

Constructs a FixedTimeProvider using the provided $timestamp

Parameters

array $timestamp Array containing sec and usec components of a timestamp

Exceptions

InvalidArgumentException if the $timestamp does not contain sec or usec components

setUsec(int $value)

Sets the usec component of the timestamp

Parameters

int $value The usec value to set

setSec(int $value)

Sets the sec component of the timestamp

Parameters

int $value The sec value to set

int[] currentTime()

Returns a timestamp array

Return Value

int[] Array guaranteed to contain sec and usec components of a timestamp