You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							26 lines
						
					
					
						
							627 B
						
					
					
				
			
		
		
	
	
							26 lines
						
					
					
						
							627 B
						
					
					
				var Sntp = require('../lib');
 | 
						|
 | 
						|
// All options are optional
 | 
						|
 | 
						|
var options = {
 | 
						|
    host: 'nist1-sj.ustiming.org',  // Defaults to pool.ntp.org
 | 
						|
    port: 123,                      // Defaults to 123 (NTP)
 | 
						|
    resolveReference: true,         // Default to false (not resolving)
 | 
						|
    timeout: 1000                   // Defaults to zero (no timeout)
 | 
						|
};
 | 
						|
 | 
						|
// Request server time
 | 
						|
 | 
						|
Sntp.time(options, function (err, time) {
 | 
						|
 | 
						|
    if (err) {
 | 
						|
        console.log('Failed: ' + err.message);
 | 
						|
        process.exit(1);
 | 
						|
    }
 | 
						|
 | 
						|
    console.log(time);
 | 
						|
    console.log('Local clock is off by: ' + time.t + ' milliseconds');
 | 
						|
    process.exit(0);
 | 
						|
});
 | 
						|
 |