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

MySQL incorrect sub-second precision

    XMLWordPrintable

Details

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

    Description

      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).

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes