clocks suck

This commit is contained in:
uli
2023-01-26 00:01:40 +01:00
parent 6d85fa155e
commit 123c81777a
8 changed files with 105 additions and 392 deletions

View File

@ -24,14 +24,7 @@ TEST_CASE("OSAL::Clock Test", "[OSAL::Clock Test]") {
// We require timeOfDayAsTimeval to be larger than time as it
// was request a few ns later
double difference = timevalOperations::toDouble(timeOfDayAsTimeval - time);
uint32_t ticksPerSecond =Clock:: getTicksPerSecond();
float secondPerTick = 0;
if (ticksPerSecond != 0){
secondPerTick = 1.0 / ticksPerSecond;
}
// In rtems, timevals have microsecond resolution, while TOD has only tick resolution, leading to
// negative differences when comparing "equal" times
CHECK(difference >= -secondPerTick);
CHECK(difference >= 0);
CHECK(difference <= 0.005);
// Conversion in the other direction