Skip to content

Commit

Permalink
Merge pull request ethereum#3146 from ethereum/update-os-timesync
Browse files Browse the repository at this point in the history
Mac OSX High Sierra fix + Skips timesync check flag
  • Loading branch information
evertonfraga authored Oct 11, 2017
2 parents 82858fd + 6a3c643 commit 538f42f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 24 deletions.
37 changes: 18 additions & 19 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,26 +270,25 @@ onReady = () => {
});
}

// check time sync
// var ntpClient = require('ntp-client');
// ntpClient.getNetworkTime("pool.ntp.org", 123, function(err, date) {
timesync.checkEnabled((err, enabled) => {
if (err) {
log.error('Couldn\'t get time from NTP time sync server.', err);
return;
}

if (!enabled) {
dialog.showMessageBox({
type: 'warning',
buttons: ['OK'],
message: global.i18n.t('mist.errors.timeSync.title'),
detail: `${global.i18n.t('mist.errors.timeSync.description')}\n\n${global.i18n.t(`mist.errors.timeSync.${process.platform}`)}`,
}, () => {
});
}
});
// Checks time sync
if (!Settings.skiptimesynccheck) {
timesync.checkEnabled((err, enabled) => {
if (err) {
log.error('Couldn\'t infer if computer automatically syncs time.', err);
return;
}

if (!enabled) {
dialog.showMessageBox({
type: 'warning',
buttons: ['OK'],
message: global.i18n.t('mist.errors.timeSync.title'),
detail: `${global.i18n.t('mist.errors.timeSync.description')}\n\n${global.i18n.t(`mist.errors.timeSync.${process.platform}`)}`,
}, () => {
});
}
});
}

const kickStart = () => {
// client binary stuff
Expand Down
13 changes: 12 additions & 1 deletion modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ const argv = require('yargs')
group: 'Mist options:',
type: 'boolean',
},
skiptimesynccheck: {
demand: false,
requiresArg: false,
nargs: 0,
describe: 'Disable checks for the presence of automatic time sync on your OS.',
group: 'Mist options:',
type: 'boolean',
},
'': {
describe: 'To pass options to the underlying node (e.g. Geth) use the --node- prefix, e.g. --node-datadir',
group: 'Node options:',
Expand All @@ -141,7 +149,6 @@ const argv = require('yargs')
.alias('h', 'help')
.parse(process.argv.slice(1));


argv.nodeOptions = [];

for (const optIdx in argv) {
Expand Down Expand Up @@ -304,6 +311,10 @@ class Settings {
this.saveConfig('ui.i18n', langCode);
}

get skiptimesynccheck() {
return argv.skiptimesynccheck;
}

initConfig() {
global.config.insert({
ui: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"minimongo-standalone": "^1.1.0-3",
"numeral": "^2.0.6",
"oboe": "^2.1.3",
"os-timesync": "^1.0.7",
"os-timesync": "^1.0.8",
"semver": "^5.1.0",
"solc": "^0.4.15",
"swarm-js": "^0.1.21",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3814,9 +3814,9 @@ os-locale@^1.4.0:
dependencies:
lcid "^1.0.0"

os-timesync@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/os-timesync/-/os-timesync-1.0.7.tgz#fc7ea7e6de1fc88742880cd08ff284327678e20d"
os-timesync@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/os-timesync/-/os-timesync-1.0.8.tgz#390ae8832e20183ea3fc1b97ea90bcbc97c0178f"

os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.1:
version "1.0.2"
Expand Down

0 comments on commit 538f42f

Please sign in to comment.