|
BDE 4.39.x Production Release
|
#include <bdlmt_eventscheduler.h>
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 EventSchedulerTestTimeSource 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.
now.Public Member Functions | |
| BSLMF_NESTED_TRAIT_DECLARATION (EventSchedulerTestTimeSource, bslma::UsesBslmaAllocator) | |
| EventSchedulerTestTimeSource (EventScheduler *scheduler, bslma::Allocator *basicAllocator=0) | |
| bsls::TimeInterval | advanceTime (bsls::TimeInterval amount) |
| bsls::TimeInterval | now () const |
|
explicit |
Create a test time-source object that will control the "system-time" observed by the specified scheduler. Initialize now to be an arbitrary time value.
scheduler. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. EventScheduler associated with this time source. | bsls::TimeInterval bdlmt::EventSchedulerTestTimeSource::advanceTime | ( | bsls::TimeInterval | amount | ) |
Advance this object's current-time value by the specified amount of time, notify the scheduler that the time has changed, and wait for the scheduler to process the events triggered by this change in time. Return the updated current-time value.
amount is positive, and now + amount is within the range that can be represented with a bsls::TimeInterval. | bdlmt::EventSchedulerTestTimeSource::BSLMF_NESTED_TRAIT_DECLARATION | ( | EventSchedulerTestTimeSource | , |
| bslma::UsesBslmaAllocator | |||
| ) |
| bsls::TimeInterval bdlmt::EventSchedulerTestTimeSource::now | ( | ) | const |
Return this object's current-time value. Upon construction, this method will return an arbitrary value. Subsequent calls to advanceTime will adjust the arbitrary value forward.