Skip to content

vigreco/exact-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Get the exact date and time with ease

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published