Module to encode and decode timestamps to/from TimeHashes
timehash is an algorithm (with multiple reference implementations) for calculating variable precision sliding windows of time. When performing aggregations and correlations on large-scale data sets, the ability to convert precise time values into ‘malleable intervals’ allows for many novel analytics.
Using sliding windows of time is a common practice in data analysis but prior to the timehash algorithm it was more of an art than a science.
Example of calculating a timehash value in python:
import timehash import time rightnow = time.time() rightnow60 = rightnow + 60.0 rightnow_hash = timehash.encode(rightnow, precision=10) rightnow60_hash = timehash.encode(rightnow60, precision=10) print 'timehash of right now: %s' % rightnow_hash print 'timehash of now +60s: %s'% rightnow60_hash % timehash of right now: ae0f0ba1fc % timehash of now +60s: ae0f0baa1c