Skip to content

Commit

Permalink
fix rt test
Browse files Browse the repository at this point in the history
  • Loading branch information
ikod committed Dec 15, 2019
1 parent e2391e0 commit dc2374a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions source/timingwheels/timingwheels_impl.d
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,11 @@ unittest
TimingWheels!Timer w;
Duration Tick = 5.msecs;
w.init();
shouldApproxEqual(w.currStdTime(Tick)*1e0 - Clock.currStdTime*1e0, 0);
Thread.sleep(2*Tick);
ulong now = Clock.currStdTime;
shouldApproxEqual((now - w.currStdTime(Tick))*1e0, (2*Tick).split!"hnsecs".hnsecs*1e0, 3e-2);
assert(now - w.currStdTime(Tick) < 5*10_000);
Thread.sleep(2*Tick);
now = Clock.currStdTime;
assert((now - w.currStdTime(Tick))/10_000 - (2*Tick).split!"msecs".msecs < 10);
auto toCatchUp = w.ticksToCatchUp(Tick, now);
toCatchUp.shouldEqual(2);
auto t = w.advance(toCatchUp);
Expand Down Expand Up @@ -904,4 +905,4 @@ unittest
// emulate some random processing time
Thread.sleep(uniform(0, 5, rnd).msecs);
}
}
}

0 comments on commit dc2374a

Please sign in to comment.