Move timestamp updating to an exported function for testing purposes

(imported from commit 9d632eb03564899fe2c8ad937d9e2aaac94e1396)
This commit is contained in:
Reid Barton
2013-02-26 14:44:44 -05:00
parent 593af9daa8
commit 318ee5df7d

View File

@@ -87,7 +87,9 @@ exports.render_time = function (time) {
return node; return node;
}; };
setInterval(function () { // This isn't expected to be called externally except manually for
// testing purposes.
exports.update_timestamps = function () {
var start_of_today = set_to_start_of_day(now()); var start_of_today = set_to_start_of_day(now());
var new_date; var new_date;
// This loop won't do anything unless the day changed since the // This loop won't do anything unless the day changed since the
@@ -118,7 +120,9 @@ setInterval(function () {
} }
} }
last_updated = start_of_today; last_updated = start_of_today;
}, 60 * 1000); };
setInterval(exports.update_timestamps, 60 * 1000);
return exports; return exports;
}()); }());