0.0.3 • Published 6 years ago

exact-time v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

exact-time

Promise based lib to get the exact date and time with ease.

Installation

$ npm install --save exact-time

Usage

const exactTime = require('exact-time')

exactTime.getDate()
  .then(date => console.log(date.toString()))

// Thu May 11 2017 12:20:40 GMT+0200 (CEST)

Example

$ node examples/time.js

Exact time:  Thu May 11 2017 12:20:40 GMT+0200 (CEST)
Your system clock is 1 minute and 7 seconds behind.

API

getDate(forceNetSync)

Type: Date Returns a Date object with the exact time.

getOffset(forceNetSync)

Type: Number Returns the difference between system time and exact time in seconds.

forceNetSync

Type: Boolean Forces a new time sync with the server.

License

MIT © Vincenzo Greco