From 51a2100ffe5c998dcfa388c5fda94186c1ae984d Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 18 Dec 2013 18:19:37 -0500 Subject: [PATCH] =?UTF-8?q?correct=20issue=20of=20dangling=20=C2=B5s=20in?= =?UTF-8?q?=20buckets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit we are parsing at microsecond resolution, however the previous floor methodology was only zeroing out seconds, not also microseconds. This causes bucket alignment issues, and broke the graphs page. Change-Id: I688bb4bc9ef9fee2167dd2e94a25f060d4025afd --- elastic_recheck/results.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elastic_recheck/results.py b/elastic_recheck/results.py index c3850bab..24936255 100644 --- a/elastic_recheck/results.py +++ b/elastic_recheck/results.py @@ -112,7 +112,9 @@ class FacetSet(dict): ts = datetime.datetime.strptime(data, "%Y-%m-%dT%H:%M:%S.%fZ") tsepoch = int(time.mktime(ts.timetuple())) # take the floor based on resolution - ts -= datetime.timedelta(seconds=(tsepoch % res)) + ts -= datetime.timedelta( + seconds=(tsepoch % res), + microseconds=ts.microsecond) # ms since epoch epoch = datetime.datetime.utcfromtimestamp(0) pos = int(((ts - epoch).total_seconds()) * 1000)