This commit is contained in:
plane000
2018-07-23 10:30:37 +01:00
parent 0dc8d7d56c
commit 3f74792e84
10 changed files with 798 additions and 44 deletions

View File

@@ -0,0 +1,18 @@
module.exports.currenttime = function() {
let d = new Date(Date.now());
return `[${pad(d.getHours(), 2)}:${pad(d.getMinutes(), 2)}:${pad(d.getSeconds(), 2)}]`;
}
function pad(n, width, z) {
z = z || '0';
n = n + '';
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
}
module.exports.sleep = function(ms) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, ms);
});
}