Skip to content

Instantly share code, notes, and snippets.

@tzuhsun
Last active January 4, 2018 09:07
Show Gist options
  • Select an option

  • Save tzuhsun/a30b9da494d339f16e29a1f8ea537c1b to your computer and use it in GitHub Desktop.

Select an option

Save tzuhsun/a30b9da494d339f16e29a1f8ea537c1b to your computer and use it in GitHub Desktop.

Revisions

  1. tzuhsun revised this gist Jan 4, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion C++ sleep
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    https://github.com/ErikDubbelboer/node-sleep/issues/24
    // Reference
    // https://github.com/ErikDubbelboer/node-sleep/issues/24

    #include <chrono>
    #include <thread>
  2. tzuhsun revised this gist Jan 4, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion C++ sleep
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    [https://github.com/ErikDubbelboer/node-sleep/issues/24](https://github.com/ErikDubbelboer/node-sleep/issues/24)
    https://github.com/ErikDubbelboer/node-sleep/issues/24

    #include <chrono>
    #include <thread>
  3. tzuhsun renamed this gist Jan 4, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. tzuhsun renamed this gist Jan 4, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. tzuhsun revised this gist Jan 4, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion C++ sleep
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    // https://github.com/ErikDubbelboer/node-sleep/issues/24
    [https://github.com/ErikDubbelboer/node-sleep/issues/24](https://github.com/ErikDubbelboer/node-sleep/issues/24)

    #include <chrono>
    #include <thread>
  6. tzuhsun revised this gist Jan 4, 2018. No changes.
  7. tzuhsun revised this gist Jan 4, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions C++ sleep
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    // https://github.com/ErikDubbelboer/node-sleep/issues/24

    #include <chrono>
    #include <thread>

  8. tzuhsun created this gist Jan 4, 2018.
    9 changes: 9 additions & 0 deletions C++ sleep
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #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 */