correct issue of dangling µs in buckets

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
This commit is contained in:
Sean Dague 2013-12-18 18:19:37 -05:00
parent 37a9e6fa82
commit 51a2100ffe

View File

@ -112,7 +112,9 @@ class FacetSet(dict):
ts = datetime.datetime.strptime(data, "%Y-%m-%dT%H:%M:%S.%fZ") ts = datetime.datetime.strptime(data, "%Y-%m-%dT%H:%M:%S.%fZ")
tsepoch = int(time.mktime(ts.timetuple())) tsepoch = int(time.mktime(ts.timetuple()))
# take the floor based on resolution # take the floor based on resolution
ts -= datetime.timedelta(seconds=(tsepoch % res)) ts -= datetime.timedelta(
seconds=(tsepoch % res),
microseconds=ts.microsecond)
# ms since epoch # ms since epoch
epoch = datetime.datetime.utcfromtimestamp(0) epoch = datetime.datetime.utcfromtimestamp(0)
pos = int(((ts - epoch).total_seconds()) * 1000) pos = int(((ts - epoch).total_seconds()) * 1000)