Last active
January 4, 2018 09:07
-
-
Save tzuhsun/a30b9da494d339f16e29a1f8ea537c1b to your computer and use it in GitHub Desktop.
C++ 11 sleep function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Reference | |
| // https://github.com/ErikDubbelboer/node-sleep/issues/24 | |
| #include <chrono> | |
| #include <thread> | |
| std::this_thread::sleep_for(std::chrono::nanoseconds(ssec)); /* signed integer of 64+ bits */ | |
| std::this_thread::sleep_for(std::chrono::microseconds(usec)); /* signed integer of 55+ bits */ | |
| std::this_thread::sleep_for(std::chrono::milliseconds(ms)); /* signed integer of 45+ bits */ | |
| std::this_thread::sleep_for(std::chrono::seconds(sec)); /* signed integer of 35+ bits */ | |
| std::this_thread::sleep_for(std::chrono::minutes(min)); /* signed integer of 29+ bits */ | |
| std::this_thread::sleep_for(std::chrono::hours(hrs)); /* signed integer of 23+ bits */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment