23{
24
27
29
30 unsigned int const numOfIter = 10U;
31
32 std::random_device randomDevice;
33 std::default_random_engine randomGenerator(randomDevice());
34 std::uniform_int_distribution<int> probDistribution(5000, 15000);
35
36 for( unsigned int i = 0U; i < numOfIter; ++i )
37 {
38
39 auto const sleepFor = probDistribution(randomGenerator);
40 std::chrono::milliseconds delay{ std::chrono::milliseconds (sleepFor) };
41 std::this_thread::sleep_for(std::chrono::milliseconds{ delay });
42
43
45
46 auto const delayTimeMilliseconds = std::chrono::duration_cast<std::chrono::duration<float>>(delay).count();
48 std::cout << "Delay: " << delayTimeMilliseconds << "Elapsed app time: " << elapsedTimeMilliseconds << std::endl;
49
50 EXPECT_TRUE(delayTimeMilliseconds <= elapsedTimeMilliseconds);
51 }
52}
Provides high-resolution timing for frame updates.
void Reset()
Resets the clock to the current system time.
void UpdateAppTime(AppTime &appTime)
Updates the given AppTime instance with elapsed and total durations.
Manages current, total, and elapsed time for the application.
const float ElapsedAppTimeMilliseconds() const
Returns elapsed time since the last frame in milliseconds (float).