Neoclassical Programming Multitude

npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

clock-util

1.0.2 • Public • Published

clock-util

An extended Clock with additional functionality

installation

> npm install clock-util

usage

default to system clock:

const ClockUtil = require('clock-util')
const clock = new ClockUtil()

or wrap any Clock:

const fixedClock = {now: () => 123456}
const clock = new ClockUtil(fixedClock)

now we have some extra utility methods available:

// Returns the timestamp in milliseconds since the Unix epoch from the current clock time
// this is the same as Clock interface
clock.now()
// => 123456
 
clock.date() // Returns a Date object from the current clock time
// => new Date(123456)
 
clock.nowSeconds() // Returns the number of seconds since the Unix epoch
// => 123

license

ISC

install

npm i clock-util

Downloadsweekly downloads

29

version

1.0.2

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability