BloombergLP::bdlmt::TimerEventSchedulerTestTimeSource

Test helper that substitutes a controllable clock into a timer scheduler.

Synopsis

Declared in <bdlmt_timereventscheduler.h>

class TimerEventSchedulerTestTimeSource;

Description

This class provides a means to change the clock that is used by a given event-scheduler to determine when events should be triggered. Constructing a TimerEventSchedulerTestTimeSource alters the behavior of the supplied event-scheduler. After a test time-source is created, the underlying scheduler will run events according to a discrete timeline, whose successive values are determined by calls to advanceTime on the test time-source, and can be retrieved by calling now on that test time-source. Note that the "system-time" held by a test time-source does not correspond to the current system time. Test writers must use caution when scheduling absolute-time events so that they are scheduled relative to the test time-source's value for now.

Member Functions

NameDescription
TimerEventSchedulerTestTimeSource [constructor]Construct a test time-source that controls the given scheduler's clock.
advanceTime Advance this object's current time by the specified amount.
now Return this object's current test-time value.