Source: https://stackoverflow.com/questions/158585/how-do-you-add-a-timed-delay-to-a-c-program
#include <chrono>
#include <iostream>
#include <thread>
int main() {
using namespace std::this_thread; // sleep_for, sleep_until
using namespace std::chrono_literals; // ns, us, ms, s, h, etc.
using std::chrono::system_clock;
std::cout << "Sleeping for 5 s" << std::endl;
sleep_for(5s);
std::cout << "Sleeping for 10 ns" << std::endl;
sleep_for(10ns);
std::cout << "Sleeping for 1 ms" << std::endl;
sleep_until(system_clock::now() + 1ms);
std::cout << "All done." << std::endl;
}