Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
incrementing_clock Class Reference
Inheritance diagram for incrementing_clock:
core\clock Psr\Clock\ClockInterface

Public Member Functions

 __construct (?int $starttime=null,)
 Create a new instance of the incrementing clock.
 
 bump (int $seconds=1)
 Bump the time by a number of seconds.
 
 now ()
 
 set_to (int $time)
 Set the time of the clock.
 
 time ()
 Return the unix time stamp for the current representation of the time.
 

Public Attributes

int int $time
 The next time of the clock.
 

Constructor & Destructor Documentation

◆ __construct()

incrementing_clock::__construct ( ?int $starttime = null)

Create a new instance of the incrementing clock.

Parameters
null | int$starttimeThe initial time to use. If not specified, the current time is used.

Member Function Documentation

◆ bump()

incrementing_clock::bump ( int $seconds = 1)

Bump the time by a number of seconds.

Note: The act of fetching the time will also bump the time by one second.

Parameters
int$seconds

◆ now()

incrementing_clock::now ( )

◆ set_to()

incrementing_clock::set_to ( int $time)

Set the time of the clock.

Parameters
int$time

◆ time()

incrementing_clock::time ( )

Return the unix time stamp for the current representation of the time.

Return values
int

Implements core\clock.


The documentation for this class was generated from the following file: