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

QDateTime and QTime ::secsTo do take milliseconds into account

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.0.0
    • 4.6.2
    • Core: Date/Time
    • None
    • I9efe0c8f710db859c1d086d67ba3e5b349a56c4e

    Description

      The documentation states that "secsTo() does not take into account any milliseconds", however, this is not the case. Given times 12:30:01.500 and 12:30:02.400 secsTo returns 0. If milliseconds are not taken into account, I would expect this to return 1 (i.e. interprets the times as 12:30:01 and 12:30:02 thus truncating the milliseconds). This how the documentation reads and is more useful as any desiring the current effect can do "msecsTo() / 1000" which is what the current functionality offers.

      I have already submitted a merge request which fixes this issue (see http://qt.gitorious.org/qt/qt/merge_requests/500). I have extended the unit test to test some times with milliseconds as this was not done before. Even though this affects 4.6.2 I wouldn't expect it to be added until 4.7.

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            jhollingsworth Jason Hollingsworth
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes