IRC-SPHERE / HyperStream

HyperStream
https://irc-sphere.github.io/HyperStream/
MIT License
13 stars 5 forks source link

ti.end in the future issue with Tutorial 1. (related to precision defined in /utils/time_utils.py) #22

Closed Srceh closed 7 years ago

Srceh commented 7 years ago

As I just reinstall my Ubuntu I tried to run Tutorial 1 again for a test.

The issue occurs in the (Executing a new interval) section, which I think is caused by the precision of utcnow() defined in hyperstream/utils/time_utils.py.

It is interesting I didn't have this issue in the past...

For instance:

interval.end = datetime.datetime(2017, 8, 18, 9, 41, 14, 262064, tzinfo=) utcnow() = datetime.datetime(2017, 8, 18, 9, 41, 14, 262000, tzinfo=)

137             if interval.end > utcnow():
138                 print [interval.end, utcnow()]

--> 139 raise ValueError("Calculated intervals should not be in the future") 140 141 self._calculated_intervals = value

ValueError: Calculated intervals should not be in the future

perellonieto commented 7 years ago

To avoid all these problems, we should just change the time intervals of the tutorials to at least some minutes or hours in the past.

tdiethe commented 7 years ago

HyperStream is only millisecond precise, so this comparison should be changed to remove microseconds.

tdiethe commented 7 years ago

Should now be fixed with https://github.com/IRC-SPHERE/HyperStream/commit/fb58a388c5f5e844032987ac5e180263e9637519

Would be good if someone were to write a unit test to verify this.