defunctzombie / node-process

process information for node.js and browsers
MIT License
122 stars 62 forks source link

Missing `process.uptime()` #54

Closed langri-sha closed 8 years ago

langri-sha commented 8 years ago

Missing from the API https://nodejs.org/api/process.html#process_process_uptime. Returns number of seconds since the process has been running.

calvinmetcalf commented 8 years ago

in light of https://github.com/defunctzombie/node-process#browser-implementation not adding it might be the best case forward as that allows others to polyfill it if they want

langri-sha commented 8 years ago

Thank you for pointing to the :memo:, makes perfect sense. If anyone wants to follow the guidelines, here's how I patched mine:

const zulu = Date.now(); // Evaluated when monkeypatch module is first required.

// Seconds since Zulu.
process.uptime = () => Math.ceil((Date.now() - zulu) / 1000);
calvinmetcalf commented 8 years ago

yeah I put it into my es6 version of this module, because there extra imports are less important.