msoon / PyMonsoon

Monsoon Power Monitor Python Library
MIT License
55 stars 23 forks source link

Drop casting of time.time() to int, during sample collection. #27

Closed yusufm closed 5 years ago

yusufm commented 5 years ago

Currently, when collecting samples, and when legacy_timestamp has been set to True, the time.time() value is cast to int, which is reducing the precision of the timestamp. There does not seem to be any reason to return an int for timestamp. And, the documentation for the function mentions that if legacy_timestamp is set to True, it will return time.time(). So this change is more accurate given existing docstring, and will increase the precision of the timestamp value returned.

yusufm commented 5 years ago

After trying out this code change, looks like there might be issues with the packet handling, so the value gets corrupted if greater than int.

yusufm commented 5 years ago

Closing this request, since there seems to be some underlying issue that needs to be resolved. Opened issue #28 to track this.