Category : time

I’m trying to create a as-steady-as-possible update loop using std::chrono. I came up with the following implementation and profiled the actual update/frame durations: bool firstUpdate = true; std::chrono::time_point<std::chrono::steady_clock> lastUpdateTime; std::chrono::time_point<std::chrono::steady_clock> lastUpdateProf; while (true) { if (firstUpdate) { lastUpdateTime = std::chrono::steady_clock::now(); firstUpdate = false; } lastUpdateTime = lastUpdateTime + std::chrono::milliseconds(100); // Do the work, generate data ..

Read more

The purpose of my program is to calculate the time of the car which staying in a particular place of the image. When the car is inside the place, I need to start chronometer for this car. I would like to run car_crono[i]->start_chrono(chrono) inside multiple thread like this std::thread(car_crono[i]->start_chrono, chrono) Here is my code: for(int ..

Read more

The purpose of my program is to calculate the time of the car which staying in a particular place of the image. When the car is inside the place, I need to start chronometer for this car. I would like to run car_crono[i]->start_chrono(chrono) inside multiple thread like this std::thread(car_crono[i]->start_chrono, chrono) Here is my code: for(int ..

Read more