Time intervals and high resolution time helpers, browser compatible
const {diff, after, isAfter, now, spare} = require('ut-function.timing')
Where
diff(time1, time2)
- difference in milliseconds between two high resolution time valuestime1
andtime2
after(interval)
- get local high resolution time value after specified timeinterval
in millisecondsisAfter(time, timeout)
- check if high resolutiontime
is after high resolution valuetimeout
now
- get curren time as high resolution valuespare(time, latency)
- get remaining time between current time and passedtime
, minus the optional expected network or otherlatency