Time based rolling average calculations for node.js