SysBackup/timer.js

15 lines
268 B
JavaScript
Raw Normal View History

2022-08-08 14:26:26 +00:00
/* eslint-disable require-jsdoc */
const prettytime = require('prettytime');
2022-08-08 12:39:35 +00:00
class Timer {
2022-08-08 14:26:26 +00:00
startTimer() {
this.start = Date.now();
return this;
}
2022-08-08 12:39:35 +00:00
2022-08-08 14:26:26 +00:00
endTimer() {
return prettytime(Date.now() - this.start, {decimals: 2});
}
2022-08-08 12:39:35 +00:00
}
2022-08-08 14:26:26 +00:00
module.exports = Timer;