Documentation

Epoch
in package

Stores the current time as a fixed value.

This is useful for ensuring that times are used consistently within the context of an individual page request. It does not, however, represent the start time of the request.

The static methods are a convenience wrapper around the instance of this class stored in the DI container (which is set on the first query, and then remains unchanged in subsequent calls).

Table of Contents

Properties

$microtime  : float
$time  : int

Methods

__construct()  : mixed
getMicrotime()  : float
getTime()  : int
microtime()  : float
Return the time (in seconds, with microsecond-level precision) associated with a page request (i.e. stored in the DI container).
time()  : int
Return the time (in seconds) associated with a page request (i.e. stored in the DI container).
update()  : void
Update the time associated with this page request (i.e. stored in the DI container).
getInstance()  : self
Returns the instance of this class from the DI container.

Properties

$microtime read-only

private float $microtime

$time read-only

private int $time

Methods

__construct()

public __construct() : mixed

getMicrotime()

public getMicrotime() : float
Return values
float

getTime()

public getTime() : int
Return values
int

microtime()

Return the time (in seconds, with microsecond-level precision) associated with a page request (i.e. stored in the DI container).

public static microtime() : float
Return values
float

time()

Return the time (in seconds) associated with a page request (i.e. stored in the DI container).

public static time() : int
Return values
int

update()

Update the time associated with this page request (i.e. stored in the DI container).

public static update() : void

NOTE: This should never be called by normal page requests, and should only be used by the CLI programs that run continuously.

getInstance()

Returns the instance of this class from the DI container.

private static getInstance() : self

The first time this is called, it will populate the DI container, and this will be the time associated with the page request.

Return values
self

        
On this page

Search results