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

QChrono::remainingTime() can not return anything larger than ~24days

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.8
    • Core: Date/Time
    • None
    • Windows

    Description

      The original report is from the forum: https://forum.qt.io/topic/160278

      QChronoTimer::remainingTime() can not return a duration > ~24days due to an integer overflow inside int QEventDispatcherWin32::remainingTime() because this function can only return integers in Qt6.
      I wonder why this should work on linux with gcc13 though (at least someone else from the forum checked it with this combination)

      Reproducer:

      int main(int argc, char **argv)
      {
          QCoreApplication app(argc, argv);
          ChronoTimer timer;
          qint64 interval = 24;
          timer.setInterval(days(interval));
          timer.start();
          qDebug() << "days:" << duration_cast<days>(timer.remainingTime()).count();
      
          QChronoTimer timer2;
          interval = 25;
          timer2.setInterval(days(interval));
          timer2.start();
          qDebug() << "days:" << duration_cast<days>(timer2.remainingTime()).count();
      }
      

      Attachments

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

        Activity

          People

            cnn Qt Core & Network
            chehrlic Christian Ehrlicher
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes