Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clock-tickr

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clock-tickr

A ticker that emits tick events at a clock-sychronised, self-adjusting interval.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

ClockTickr :alarm_clock:

A very simple ticker that emits tick events at a clock-sychronised, self-adjusting interval.

JavaScript Style Guide

Features

  • It ticks at the specified interval.
  • It keeps itself synchronised with the system clock.
  • .. more ticks.

Installation

npm install --save clock-tickr

Usage:

Create a ClockTickr instance, with an optional tick interval in ms (default is 1000) and start it. See below.

const ClockTickr = require('clock-tickr')

let tickr = new ClockTickr({ interval: 250 })

tickr.on('tick', (tick) => {
  console.log(tick)
  
})

tickr.start()

results in (when you change the system time while running)

...
{ actual: 1539887917504, expected: 1539887917500, drift: 4 }
{ actual: 1539887917753, expected: 1539887917750, drift: 3 }
{ actual: 1539886920168, expected: 1539887918000, drift: -997832 }
Did you travel in time?
{ actual: 1539886920501, expected: 1539886920500, drift: 1 }
{ actual: 1539886920751, expected: 1539886920750, drift: 1 }
...

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Credits

License

MIT

FAQs

Package last updated on 18 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc