metomi/isodatetime

TimePoint dumping buggy for decimals that round up to 1

MetRonnie opened this issue · 0 comments

Example:

>>> TimePoint(year=2020, second_of_minute=5, second_of_minute_decimal=0.9999999)
<metomi.isodatetime.data.TimePoint: 2020-01-01T00:00:05,1.Z>

Instead of 00:00:05,1.Z it should be 00:00:06,0Z.

That would make the behaviour in line with rounding down, e.g.

>>> TimePoint(year=2020, second_of_minute=6, second_of_minute_decimal=0.000000000001)
<metomi.isodatetime.data.TimePoint: 2020-01-01T00:00:06,0Z>

Another question is if the stripping of trailing zeroes when rounding to 6 decimal places is misleading about the precision/number of significant figures