-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nigel Hanlon
committed
Sep 9, 2015
0 parents
commit 18be426
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## Netclock | ||
|
||
Netclock is a very simple command line tool for querying ntp and comparing the result with the system time. | ||
|
||
Uses pool.ntp.org as a time server. | ||
|
||
## Usage | ||
|
||
``` | ||
$ npm install netclock | ||
$ netclock | ||
____________________________________________________ | ||
System time : Wed Sep 09 2015 17:51:15 GMT+0100 (IST) | ||
Network time : Wed Sep 09 2015 17:51:33 GMT+0100 (IST) | ||
____________________________________________________ | ||
``` | ||
|
||
## License | ||
|
||
MIT License (MIT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env node | ||
|
||
var colors = require('colors'); | ||
var ntpClient = require('ntp-client'); | ||
|
||
ntpClient.getNetworkTime("pool.ntp.org", 123, function(err, date) { | ||
if(err) { | ||
console.error("%s".red, err); | ||
process.exit(1) | ||
return; | ||
} | ||
console.log(' ____________________________________________________\n'.blue); | ||
console.log(" System time : %s".blue, new Date()); | ||
console.log(" Network time : %s".green, date); | ||
console.log('\n ____________________________________________________'.blue); | ||
process.exit(0) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "netclock", | ||
"version": "1.0.0", | ||
"description": "A simple tool for querying network timeservers", | ||
"main": "index.js", | ||
"bin": { | ||
"netclock": "index.js" | ||
}, | ||
"keywords": [ | ||
"time", | ||
"net", | ||
"server", | ||
"ntp" | ||
], | ||
"author": "Nigel Hanlon <[email protected]>", | ||
"contributors": [ | ||
{ | ||
"name": "Nigel Hanlon", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"colors" : "*", | ||
"ntp-client": "*" | ||
} | ||
} |