Skip to content

Instantly share code, notes, and snippets.

@erezrokah
Created June 13, 2019 14:49
Show Gist options
  • Save erezrokah/3fbe380840223a82fde16a16976a0908 to your computer and use it in GitHub Desktop.
Save erezrokah/3fbe380840223a82fde16a16976a0908 to your computer and use it in GitHub Desktop.
Testing Date.now vs Date.parse(new Date().toUTCString())
const sleep = async seconds => {
return new Promise((resolve, reject) => setTimeout(resolve, seconds * 1000));
};
(async () => {
for (let i = 0; i < 10; i++) {
console.log('-----------------------------');
console.log(Date.now());
console.log(Date.parse(new Date().toUTCString()));
console.log('-----------------------------');
await sleep(2.5);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment