Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/src/node.cc b/src/node.cc
index ac906f0..82ce0b2 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1714,13 +1714,10 @@ static Handle<Value> Uptime(const Arguments& args) {
HandleScope scope;
double uptime;
- uv_err_t err = uv_uptime(&uptime);
+ uv_update_time(uv_default_loop());
+ uptime = uv_now(uv_default_loop());
- if (err.code != UV_OK) {
- return Undefined();
- }
-
- return scope.Close(Number::New(uptime - prog_start_time));
+ return scope.Close(Number::New((uptime - prog_start_time) / 1000));
}
@@ -2893,7 +2890,7 @@ static Handle<Value> DebugEnd(const Arguments& args) {
char** Init(int argc, char *argv[]) {
// Initialize prog_start_time to get relative uptime.
- uv_uptime(&prog_start_time);
+ prog_start_time = uv_now(uv_default_loop());
// Make inherited handles noninheritable.
uv_disable_stdio_inheritance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.