Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31124

MySQL incorrect sub-second precision

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 4.8.4
    • SQL Support
    • None
    • Qt 4.8.4 / win7 x64 / 32-bit / msvc10
    • 7216387370203fc8f49d76cc2cb68bb5286c8dff

      MySQL supports sub-second precision (actually microsecond) for DATETIME, TIMESTAMP and TIME types since version 5.6.4 (see http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html), together with a recent MySQL C connector.

      However there is a bug in qsql_mysql.cpp where there is a confusion between milli and microseconds when storing a datetime into database:

      myTime->second_part = time.msec();

      should become:

      myTime->second_part = time.msec()*1000;

      This patch works fine on my machine (tested only with DATETIME fields).

        For Gerrit Dashboard: QTBUG-31124
        # Subject Branch Project Status CR V

            ccomparon Cyril C
            ccomparon Cyril C
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes