node.js check how long you run your PC
Please read how to initialize npm from this post.
1. Uptime
First, you need to type the 'const os = require('os');' to import the os module.
After that type 'console.log(os.uptime());'.
Now run the node to run index.js or index.
Enter: need to check your file path
- node index.js
- node index
The number is a second.
2. variable
build const variable to put 'os.uptime()'
- 'os_time'
3. Divide the number to 3600(using console.log)
Now print the number(os_time/3600) to find how long your does your OS run(hour).
댓글
댓글 쓰기