Skip to content

Commit

Permalink
patch electron_node
Browse files Browse the repository at this point in the history
  • Loading branch information
Micha Hanselmann committed Jul 29, 2019
1 parent 4838bd7 commit ac60f36
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/node/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch
chore_read_nobrowserglobals_from_global_not_process.patch
chore_split_createenvironment_into_createenvironment_and.patch
chore_handle_default_configuration_not_being_set_in_the_electron_env.patch
fix_set_uptime_offset_in_correct_init_method.patch
29 changes: 29 additions & 0 deletions patches/node/fix_set_uptime_offset_in_correct_init_method.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Micha Hanselmann <deermichel@github.com>
Date: Wed, 24 Jul 2019 11:44:25 -0700
Subject: fix: set uptime offset in correct init method

This patch can be removed after 'https://github.com/nodejs/node/pull/28849' landed here.

diff --git a/src/node.cc b/src/node.cc
index 707579c8254903f5c587fa42711eb5d0184b4112..64f46faa36a7b52d86b257adad6c54b93b894262 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -743,6 +743,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
// Make sure InitializeNodeWithArgs() is called only once.
CHECK(!init_called.exchange(true));

+ // Initialize node_start_time to get relative uptime.
+ per_process::node_start_time = uv_hrtime();
+
// Register built-in modules
binding::RegisterBuiltinModules();

@@ -929,7 +932,6 @@ void Init(int* argc,
InitializationResult InitializeOncePerProcess(int argc, char** argv) {
atexit(ResetStdio);
PlatformInit();
- per_process::node_start_time = uv_hrtime();

CHECK_GT(argc, 0);

0 comments on commit ac60f36

Please sign in to comment.