| 60 | } |
| 61 | |
| 62 | void SC::TimeTest::testHighResolutionCounterSnap() |
| 63 | { |
| 64 | //! [highResolutionCounterSnapSnippet] |
| 65 | Time::HighResolutionCounter start, end; |
| 66 | start.snap(); |
| 67 | Thread::Sleep(100); |
| 68 | end.snap(); |
| 69 | |
| 70 | // Test all time conversion methods |
| 71 | Time::Milliseconds elapsedMs = end.subtractExact(start).toMilliseconds(); |
| 72 | SC_TEST_EXPECT(elapsedMs < 2000_ms and elapsedMs > 0_ms); |
| 73 | |
| 74 | // Test nanoseconds conversion |
| 75 | Time::Nanoseconds elapsedNs = end.toNanoseconds(); |
| 76 | SC_TEST_EXPECT(elapsedNs.ns > 800000000); // More than 800ms in ns |
| 77 | |
| 78 | // Test seconds conversion |
| 79 | Time::Seconds elapsedSec = end.toSeconds(); |
| 80 | SC_TEST_EXPECT(elapsedSec.sec >= 0); // Should be roughly 1 second |
| 81 | |
| 82 | // Test relative time and approximate subtraction |
| 83 | Time::Relative relativeTime = end.getRelative(); |
| 84 | SC_TEST_EXPECT(relativeTime > Time::Relative::fromSeconds(0.8)); |
| 85 | |
| 86 | Time::Relative approxTime = end.subtractApproximate(start); |
| 87 | SC_TEST_EXPECT(approxTime > Time::Relative::fromSeconds(0.05)); |
| 88 | //! [highResolutionCounterSnapSnippet] |
| 89 | } |
| 90 | |
| 91 | void SC::TimeTest::testHighResolutionCounterOffsetBy() |
| 92 | { |
nothing calls this directly
no test coverage detected