interface TimeInterface (View source)

Defines an interface for obtaining system time.

Methods

int
getRequestTime()

Returns the timestamp for the current request.

float
getRequestMicroTime()

Returns the timestamp for the current request with microsecond precision.

int
getCurrentTime()

Returns the current system time as an integer.

float
getCurrentMicroTime()

Returns the current system time with microsecond precision.

Details

int getRequestTime()

Returns the timestamp for the current request.

This method should be used to obtain the current system time at the start of the request. It will be the same value for the life of the request (even for long execution times).

If the request is not available it will fallback to the current system time.

This method can replace instances of

float getRequestMicroTime()

Returns the timestamp for the current request with microsecond precision.

This method should be used to obtain the current system time, with microsecond precision, at the start of the request. It will be the same value for the life of the request (even for long execution times).

If the request is not available it will fallback to the current system time with microsecond precision.

This method can replace instances of

Return Value

float

A Unix timestamp with a fractional portion.

See also

TimeInterface::getRequestTime
TimeInterface::getCurrentTime
TimeInterface::getCurrentMicroTime

int getCurrentTime()

Returns the current system time as an integer.

This method should be used to obtain the current system time, at the time the method was called.

This method can replace many instances of

float getCurrentMicroTime()

Returns the current system time with microsecond precision.

This method should be used to obtain the current system time, with microsecond precision, at the time the method was called.

This method can replace many instances of

Return Value

float

A Unix timestamp with a fractional portion.

See also

TimeInterface::getRequestTime
TimeInterface::getRequestMicroTime
TimeInterface::getCurrentTime