diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-12-29 03:35:41 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-12-28 17:35:41 -0500 |
| commit | ae6fa914aa2f43d39ae491ac7d3140dda69702fa (patch) | |
| tree | 8ecea479750200eed8f047381a167097404db8f9 /django/db/backends/sqlite3 | |
| parent | 46d1af2e82c2b2a6976397719afde33b5cff2498 (diff) | |
Fixed #28926 -- Fixed loss of precision of big DurationField values on SQLite and MySQL.
Diffstat (limited to 'django/db/backends/sqlite3')
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index d15352dcc6..d3caa6d12a 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -17,6 +17,7 @@ from django.utils import timezone from django.utils.dateparse import ( parse_date, parse_datetime, parse_duration, parse_time, ) +from django.utils.duration import duration_microseconds from .client import DatabaseClient # isort:skip from .creation import DatabaseCreation # isort:skip @@ -471,7 +472,7 @@ def _sqlite_time_diff(lhs, rhs): def _sqlite_timestamp_diff(lhs, rhs): left = backend_utils.typecast_timestamp(lhs) right = backend_utils.typecast_timestamp(rhs) - return (left - right).total_seconds() * 1000000 + return duration_microseconds(left - right) def _sqlite_regexp(re_pattern, re_string): |
