A high-resolution timer with callback
npm install hires-timerA high-resolution timer with callback, based on this origional timer,
but modified to be more accurate on low-power devices where the timer accuracy is less guarenteed.
npm install hires-timer``javascript`
var HighResolutionTimer = require('hires-timer');
new HighResolutionTimer({
duration: 1000,
callback: function(timer) {
var hours = Math.floor( ( ( (1000 / timer.duration) * timer.total_ticks) / 60) / 24) % 24;
var minutes = Math.floor( ( (1000 / timer.duration) * timer.total_ticks) / 60) % 60;
var seconds = ( (1000 / timer.duration) * timer.total_ticks) % 60;
console.log(hours, minutes, seconds);
}
});
Include the file as a script instead
`