fix timeToIndex
Merge pull request #20 from bgirard/fix-time-to-index

fix timeToIndex