diff options
| author | Tim Graham <timograham@gmail.com> | 2016-03-10 09:22:09 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-03-10 19:16:20 -0500 |
| commit | 5b6c751230c7ec33eebc564c15ab299ef8f6852a (patch) | |
| tree | f8e765e80e611a52d6da96438cb7473c412e8f1a /django/db/models/fields | |
| parent | 301edde86d07fe27a4aa002b1546d2a3002190dc (diff) | |
[1.9.x] Fixed #26324 -- Fixed DurationField with fractional seconds on SQLite.
Backport of 4f0cd0fd162122da96978b357ac9fc9534529410 from master
Diffstat (limited to 'django/db/models/fields')
| -rw-r--r-- | django/db/models/fields/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index df2e3b45de..cf7a3c32ac 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -1665,7 +1665,8 @@ class DurationField(Field): return value if value is None: return None - return value.total_seconds() * 1000000 + # Discard any fractional microseconds due to floating point arithmetic. + return int(round(value.total_seconds() * 1000000)) def get_db_converters(self, connection): converters = [] |
