when you would like a timer callback to fire based on the timestamp of the data you are processing - the timestamp of the data when you created the timer
When you would like a timer callback to fire based on the timestamp of the data you are processing - the timestamp of the data stream when you created the timer rather than real time.
When you are processing older time series data may need to do a particular action for every one of a specific timespan of data.
// create new manager starting at timestamp 0var manager = require'logtime-interval'0;// create a timeout that should fire when i set the time to >= 1000managersetTimeoutconsole.logi fired!;1000// it is now 1000 ms since i startedmanagersetTime1000;// next tick prints// i fired !
module.exports is a function it returns a new object to manager timers.
- sets the current time and triggers execution of any pending timers
- just like setTimeout
- just like setInterval
- setTimeout returns an id
- if you pass that id to clearTimeout and it has not been called it will not be called
- setInterval returns an id
- if you pass that id to setInterval it will not be called again