#26498: Data loss of microseconds on MySQL and SQLite
----------------------------------------------+--------------------
     Reporter:  adamchainz                    |      Owner:  nobody
         Type:  Uncategorized                 |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.8
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 Django provides `django.db.backends.utils.typecast_time` as a converter
 function for MySQL and SQLite. This function uses floating point logic
 which unfortunately causes loss of precision on some values, for example:

 {{{
 In [1]: from django.db.backends.utils import typecast_time

 In [2]: typecast_time('12:45:30.126631')  # okay
 Out[2]: datetime.time(12, 45, 30, 126631)

 In [3]: typecast_time('12:45:30.126630')   # woops
 Out[3]: datetime.time(12, 45, 30, 126629)
 }}}

 This will probably only cause loss of a single microsecond, but it's
 annoying that the database doesn't roundtrip values.

--
Ticket URL: <https://code.djangoproject.com/ticket/26498>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.b597da04fc50fd3c5650e0497bfe3673%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to