test: timer: Test start() with absolute deadline
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
9d250417a2
commit
c5d682a548
1 changed files with 19 additions and 0 deletions
|
@ -35,6 +35,15 @@ public:
|
|||
Timer::start(msec);
|
||||
}
|
||||
|
||||
void start(std::chrono::steady_clock::time_point deadline)
|
||||
{
|
||||
count_ = 0;
|
||||
start_ = std::chrono::steady_clock::now();
|
||||
expiration_ = std::chrono::steady_clock::time_point();
|
||||
|
||||
Timer::start(deadline);
|
||||
}
|
||||
|
||||
int jitter()
|
||||
{
|
||||
std::chrono::steady_clock::duration duration = expiration_ - deadline();
|
||||
|
@ -127,6 +136,16 @@ protected:
|
|||
return TestFail;
|
||||
}
|
||||
|
||||
/* Timer with absolute deadline. */
|
||||
timer.start(std::chrono::steady_clock::now() + std::chrono::milliseconds(200));
|
||||
|
||||
dispatcher->processEvents();
|
||||
|
||||
if (timer.hasFailed()) {
|
||||
cout << "Absolute deadline test failed" << endl;
|
||||
return TestFail;
|
||||
}
|
||||
|
||||
/* Two timers. */
|
||||
timer.start(1000);
|
||||
timer2.start(300);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue