Skip to content

Commit 02c68a1

Browse files
committed
fix: 优化状态的运行时间显示
1 parent a602dd3 commit 02c68a1

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ config/config/pm2.yaml
2727
index.js
2828
pnpm-workspace.yaml
2929
@karinjs/
30+
/dist
3031
1.js
3132
src/test.ts
3233
*.cjs

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"dist/apps"
4949
],
5050
"ts-apps": [
51-
"dist/apps"
51+
"src/apps"
5252
],
5353
"static": [
5454
"resources"

src/apps/status.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ const MB = () => (process.memoryUsage().rss / 1024 / 1024).toFixed(2)
7171

7272
const uptime = () => {
7373
const uptime = process.uptime()
74-
const hour = Math.floor(uptime / 3600)
74+
const day = Math.floor(uptime / 86400)
75+
const hour = Math.floor((uptime % 86400) / 3600)
7576
const minute = Math.floor((uptime % 3600) / 60)
76-
return `${hour}小时${minute}分钟`
77+
const seconds = Math.floor(uptime % 60)
78+
return `${day}${hour}小时${minute}分钟${seconds}秒`
7779
}
7880

7981
(() => {

0 commit comments

Comments
 (0)