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

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

    XMLWordPrintable

Details

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

    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

        Issue Links

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

          Activity

            People

              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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes