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

provide a source of "aligned" system time

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 5.0.0
    • Component/s: Core: Date/Time
    • Labels:
      None
    • Commits:
      ef60ed1c9dbc87d9f8401036cc254a9c45cd8ca8

      Description

      In an application which shows a clock with seconds, or a second hand, it would be nice if that time was visually the same as the system time. It's not so nice if you run several clocks at the same time and they are all "ticking" at different times, up to 1 second apart. But if you start a QTimer with an interval of 1000, there is no alignment: the timeout() signal occurs approximately 1 second after the timer was started.

      Maybe we could somehow add a Qt::AlignedTimer as a possible timerType? But I don't know how achievable that is.

      Existing ways for an application to deal with this: run a delay loop to wait for a suitable moment before starting the QTimer; use some different source of time outside of Qt; or run the QTimer at a high frequency, and check whether the milliseconds component of the system time is close enough to zero before updating the display. All of those are inconvenient, and two of them have performance cost.

      Even if we had an alignedTimer, the caveat would remain that it's still inexact due to various reasons. But maybe it's worth a try to get closer by one means or another?

      QML Timers are supposed to be updated in the render thread, so maybe a good alternative would be to provide alignment only in that type of timer, by checking the milliseconds.

      Alignment to other intervals would of course be useful as well.

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes