Roundoff issues when parsing decimal seconds
Reported by firstname.lastname@example.org, Dec 19, 2012 What steps will reproduce the problem?
from iso8601 import parse_date parse_date('2012-12-19T23:21:28.512400+00:00') datetime.datetime(2012, 12, 19, 23, 21, 28, 512399, tzinfo=<FixedOffset '+00:00'>)
What is the expected output? What do you see instead?
I would expect 512400 as the microsecond value, instead 512399 appears.
What version of the product are you using? On what operating system?
Fedora 17, 64 bit.
Please provide any additional information below.
I have attached a patch which contains both a unit test for the situation presented above, and a fix using a Decimal object instead of a cast to float. This fix would break compatibility with Python versions earlier than 2.5.