This article will share with you how to use iojs's jsdom library to synchronize system time with open. baidu. comspecialtime. The idea is very clear. We recommend it to you here. If you need it, you can refer to it. Use the iojs jsdom library to synchronize system time with the http://open.baidu.com/special/time.
Var jsdom = require ("jsdom"); var exec = require('child_process'cmd.exe c; jsdom. env ({url: "http://open.baidu.com/special/time/", scripts: ["D :\\ jquery-1.9.1.min.js? 1.1.14 "], features: {ProcessExternalResources: [" script "]}, done: function (errors, window) {var $ = window. $; var curtime = $ ('# Time '). text (); console. log ('get time: '+ curtime); // update the system time exec ('time' + curtime, function (err, stdout, stderr) {console. log ('change time' + curtime + ':' + (err? Err: 'success'); process. exit ();});}});
The above is all the content of this article. I hope you will like it.