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

DateTime slow performance

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Invalid
    • Icon: P4: Low P4: Low
    • None
    • 5.3.2
    • Core: Date/Time
    • None

      There are few performances issues with QDateTime class.

      • Comparison of 2 datetimes can be very slow, even if the 2 local datetime represent the same date and time.
        For example under windows :
            QDateTime d1 = QDateTime::currentDateTime();
            qint64 ms_utc = d1.toMSecsSinceEpoch();
            QDateTime d2 = QDateTime::fromMSecsSinceEpoch(ms_utc, Qt::LocalTime, 0);
            if (d1 < d2) ...
        

        For example under linux :

            QDateTime d1 = QDateTime::currentDateTime();
            QDateTime d2 = QDateTime(d1.date(), d1.time());
            if (d1 < d2) ...
        

        The main problem here is around daylightStatus that is not set...

      • Check the validity of the datetime object is slow.
        This is normal for the first call of .isValid(), but the result should be cached for future call

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Eddy Edward Welbourne
            benjarobin Benjamin Robin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes