Skip to content

Instantly share code, notes, and snippets.

@tjfontaine
Created March 25, 2014 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjfontaine/9770725 to your computer and use it in GitHub Desktop.
Save tjfontaine/9770725 to your computer and use it in GitHub Desktop.
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