// Find a time less than start_time which occurs on a "nice" time boundary
// for this granularity.
var g = spacing / 1000;
- var d = new Date(start_time);
+ var d = new Date(start_time).setMilliseconds(0);
var x;
if (g <= 60) { // seconds
x = d.getSeconds(); d.setSeconds(x - x % g);