Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Hanlon committed Sep 9, 2015
0 parents commit 18be426
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
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)
17 changes: 17 additions & 0 deletions index.js
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)
});
27 changes: 27 additions & 0 deletions package.json
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": "*"
}
}

0 comments on commit 18be426

Please sign in to comment.