diff --git a/lib/GraphiteClient.js b/lib/GraphiteClient.js index 961f125..8343284 100644 --- a/lib/GraphiteClient.js +++ b/lib/GraphiteClient.js @@ -59,9 +59,12 @@ GraphiteClient.appendTags = function(flatMetrics, tags) { GraphiteClient.prototype.write = function(metrics, timestamp, cb) { if (typeof timestamp === 'function') { cb = timestamp; - timestamp = Date.now(); + timestamp = null; } + // default timestamp to now + timestamp = timestamp || Date.now(); + // cutting timestamp for precision up to the second timestamp = Math.floor(timestamp / 1000);