Skip to content

src: move relative uptime init

Upstreams patch from https://github.com/electron/electron/pull/19436.

We ran into an issue where process.uptime() of our embedded node runtime returned unexpected values. As we found out, the per_process::node_start_time variable which stores the relative uptime wasn't set (defaults to 0).

Previous to https://github.com/nodejs/node/pull/26016, the process-relative uptime was set in a method which got called by both node::Start (used by nodejs) and node::Init (used by embedders) init methods. After mentioned PR, it is set directly in node::Start and thereby not when using node::Init.

Since i don't see any difference in either way of setting the variable, we wanna upstream this patch so other embedders can benefit from it as well. If i miss sth, feel free to point out possible side-effects.

cc @nornagon

Checklist

Merge request reports

Loading