Created
December 13, 2018 01:59
-
-
Save almond-bongbong/4884a8270b9ad327766e07cedf30a819 to your computer and use it in GitHub Desktop.
This file contains 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
// Milliseconds | |
function sleep_ms(millisecs) { | |
var initiation = new Date().getTime(); | |
while ((new Date().getTime() - initiation) < millisecs); | |
} | |
// Seconds | |
function sleep_s(secs) { | |
secs = (+new Date) + secs * 1000; | |
while ((+new Date) < secs); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment