Documentation

FixedTimeProvider
in package
implements TimeProviderInterface

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.

Interfaces, Classes and Traits

TimeProviderInterface
TimeProviderInterface provides functionality to get the time from a specific type of time provider

Table of Contents

$fixedTime  : array<string|int, int>
__construct()  : mixed
Constructs a `FixedTimeProvider` using the provided `$timestamp`
currentTime()  : array<string|int, int>
Returns a timestamp array
setSec()  : mixed
Sets the `sec` component of the timestamp
setUsec()  : mixed
Sets the `usec` component of the timestamp

Properties

$fixedTime

private array<string|int, int> $fixedTime

Array containing sec and usec components of a timestamp

Methods

__construct()

Constructs a `FixedTimeProvider` using the provided `$timestamp`

public __construct(array<string|int, mixed> $timestamp) : mixed
Parameters
$timestamp : array<string|int, mixed>
Tags
throws
InvalidArgumentException

if the $timestamp does not contain sec or usec components

Return values
mixed

currentTime()

Returns a timestamp array

public currentTime() : array<string|int, int>
Return values
array<string|int, int>

Array containing sec and usec components of a timestamp

setSec()

Sets the `sec` component of the timestamp

public setSec(int $value) : mixed
Parameters
$value : int

The sec value to set

Return values
mixed

setUsec()

Sets the `usec` component of the timestamp

public setUsec(int $value) : mixed
Parameters
$value : int

The usec value to set

Return values
mixed

Search results