Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add process.uptime() #411

Closed
dxdc opened this issue Oct 20, 2019 · 1 comment
Closed

Add process.uptime() #411

dxdc opened this issue Oct 20, 2019 · 1 comment

Comments

@dxdc
Copy link

dxdc commented Oct 20, 2019

Is your feature request related to a problem? Please describe:
The uptime is reported as os.uptime() but doesn't give any indication of when homebridge was last restarted. It would be useful to help troubleshoot, for example, if there was a specific module that forced a restart of the homebridge service without necessarily causing a server restart.

Also, just as a point of confusion, initially I thought that Uptime meant Homebridge Uptime, not Server Uptime. It would be still useful to have both values, however.

Describe the solution you'd like:
I'm not sure if it's as simple as modifying os.uptime() here to process.uptime() and importing the process nodeJS module (e.g., /src/modules/status.service.ts. Then, to output this on the appropriate status pages.

There's a better way to refactor the uptime calculation so you wouldn't have to repeat it twice though, but just as an example:

const process = require('process');

...

    // homebridge uptime
    const procuptime: any = {
      delta: Math.floor(process.uptime()),
    };

    procuptime.days = Math.floor(procuptime.delta / 86400);
    procuptime.delta -= procuptime.days * 86400;
    procuptime.hours = Math.floor(procuptime.delta / 3600) % 24;
    procuptime.delta -= procuptime.hours * 3600;
    procuptime.minutes = Math.floor(procuptime.delta / 60) % 60;

Describe alternatives you've considered:
N/A

Additional context:
N/A

@stale
Copy link

stale bot commented Nov 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants