Documentation

MutableClock
in package
implements ClockInterface

Mutable clock class

A clock whose time can be explicitly set and advanced, for deterministic testing of TTL/expiration behavior without real sleep() calls.

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
5.0.0

Table of Contents

Interfaces

ClockInterface
Clock interface

Properties

$time  : int
Current time as a Unix timestamp

Methods

__construct()  : mixed
Constructor
advance()  : MutableClock
Advance the current time by a number of seconds
now()  : int
Get the current time as a Unix timestamp
setTime()  : MutableClock
Set the current time

Properties

$time

Current time as a Unix timestamp

protected int $time

Methods

__construct()

Constructor

public __construct([int|null $time = null ]) : mixed

Instantiate the mutable clock object

Parameters
$time : int|null = null

now()

Get the current time as a Unix timestamp

public now() : int
Return values
int

        
On this page

Search results