implement timezone

This commit is contained in:
LouisLam
2021-07-01 21:47:14 +08:00
parent 1d64f643b1
commit 55bd6b6d7a
9 changed files with 441 additions and 384 deletions

View File

@@ -80,10 +80,12 @@ class Monitor extends BeanModel {
} else if (this.type === "port") {
bean.ping = await tcping(this.hostname, this.port);
bean.msg = ""
bean.status = 1;
} else if (this.type === "ping") {
bean.ping = await ping(this.hostname);
bean.msg = ""
bean.status = 1;
}
@@ -166,11 +168,8 @@ class Monitor extends BeanModel {
if (value <= sec) {
downtime += value;
} else {
console.log("Now: " + dayjs.utc());
console.log("Time: " + dayjs(time))
let trim = dayjs.utc().diff(dayjs(time), 'second');
console.log("trim: " + trim);
value = sec - trim;
if (value < 0) {