Skip to content

Instantly share code, notes, and snippets.

@weiancheng
Last active November 1, 2021 08:18
Show Gist options
  • Save weiancheng/37a0e632e2802cc6640112bc74f350bd to your computer and use it in GitHub Desktop.
Save weiancheng/37a0e632e2802cc6640112bc74f350bd to your computer and use it in GitHub Desktop.
delay for seconds delay for milliseconds delay for nanoseconds
/// using standard library
#include <chrono>
#include <thread>
std::this_thread::sleep_for(std::chrono::seconds(10)); // delay for 10s
std::this_thread::sleep_for(std::chrono::milliseconds(10)); // delay for 10ms
std::this_thread::sleep_for(std::chrono::nanoseconds(10)); // delay for 10ns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment