diff options
author | Gerhard Weis <gerhard.weis@gmail.com> | 2012-10-30 10:38:22 +1000 |
---|---|---|
committer | Gerhard Weis <gerhard.weis@gmail.com> | 2012-10-30 10:38:22 +1000 |
commit | f16071ab3f7d16155e4b1a4c58ddb9016bd71dbe (patch) | |
tree | bce8406f74569f309287cd8f6a4057e35c17e75f /src/isodate/isotime.py | |
parent | df6341af6ceeef11c0a13bc60f7b1544cd0f3c03 (diff) | |
download | isodate-f16071ab3f7d16155e4b1a4c58ddb9016bd71dbe.tar.gz |
- round to microseconds in case provided iso date string uses higher precision
Diffstat (limited to 'src/isodate/isotime.py')
-rw-r--r-- | src/isodate/isotime.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/isodate/isotime.py b/src/isodate/isotime.py index f0003d6..091ae18 100644 --- a/src/isodate/isotime.py +++ b/src/isodate/isotime.py @@ -123,7 +123,8 @@ def parse_time(timestring): int(groups['tzhour'] or 0), int(groups['tzmin'] or 0)) if 'second' in groups: - second = Decimal(groups['second']) + # round to microseconds if fractional seconds are more precise + second = Decimal(groups['second']).quantize(Decimal('.000001')) microsecond = (second - int(second)) * long(1e6) # int(...) ... no rounding # to_integral() ... rounding |