Use of iojs's jsdom library to synchronize system time
This article is to share with you the use of iojs jsdom library and http://open.baidu.com/special/time/ synchronization system time. 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.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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"], 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.