add season.js

This commit is contained in:
lightings 2022-10-28 09:49:00 +08:00
parent 9d78c8c141
commit 459df7f160
2 changed files with 33 additions and 0 deletions

View File

@ -8,6 +8,7 @@ function add(name) {
function init() { function init() {
add('fragment'); add('fragment');
add('damping'); add('damping');
add('season');
} }
exports.init = init; exports.init = init;

View File

@ -0,0 +1,32 @@
const app = require('j7/app');
const utils = require('j7/utils');
const metaFactory = require('../metadata/factory');
const constant = require('../constant');
class Season {
async start() {
while (true) {
await this.doRoutine(utils.getUtcTime());
const nowTime = utils.getUtcTime();
const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE);
const sleepTime = daySeconds + 3600 * 24 - nowTime;
await utils.sleep(sleepTime*1000);
}
}
async doRoutine(nowTime) {
try {
}
catch(err) {
console.log(err);
}
}
}
function init() {
(new Season()).start();
}
exports.init = init;