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

QChronoTimer::remainingTime() can not return anything larger than ~24days on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3: Somewhat important P3: Somewhat important
    • 6.10.0 FF
    • 6.8
    • Core: Date/Time
    • None
    • Windows
    • 1
    • 0fb3661f1 (dev), 453d8797f (dev)
    • Foundation Sprint 123

      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();
      }
      

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

            ivan.solovev Ivan Solovev
            chehrlic Christian Ehrlicher
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes