Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTimeSpan: interest?
Qt 6.11 is out! See what's new in the release blog

QTimeSpan: interest?

Scheduled Pinned Locked Moved General and Desktop
24 Posts 17 Posters 24.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    giesbert
    wrote on last edited by
    #6

    With DST (and respectivly 23/25 h days) QDateTiem has a problem, and afaik it's not fixed up to now.

    You do not get out of QDateTime it its the first 2 o'clock in the morning or the second one :-( (DST in Germany happens at 3 o'clock with a switch back to 2 o'clock, so you have 2 o'clock two times that day).

    Same applies to the QDateTimeEdit, there you don't know, which of the two you set by setting 2:30 ...

    Nokia Certified Qt Specialist.
    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

    1 Reply Last reply
    0
    • O Offline
      O Offline
      Olorin5800
      wrote on last edited by
      #7

      Nice class. Voted for it.


      My programs never have bugs, they just develop random features.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #8

        @Gerolf:
        So, the problem is, that 02:30 on the date the clock goes back an hour is simply an ambigous time. I am not sure there is anything you can do about that, other than specifying the time in UTC instead. There are "bugreports":http://bugreports.qt.nokia.com/browse/QTBUG-10219 in Jira to ask for a better support for timezones in QDateTime.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          milot.shala
          wrote on last edited by
          #9

          Great work. I voted for it because I needed this a while ago, and for sure I will need it in the future.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AS.Sri
            wrote on last edited by
            #10

            Thanks a lot Andre, voted in JIRA.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sabrog
              wrote on last edited by
              #11

              Thanks, André. I voted.

              QT - Apple QuickTime
              Qt - Nokia's Qt Development Frameworks
              Apple is a competitor of Nokia, so QT != Qt

              1 Reply Last reply
              0
              • J Offline
                J Offline
                janarve
                wrote on last edited by
                #12

                A timespan has some pitfalls:
                If it uses walltime as the two reference points, you must handle cases where start time is actually after end time. This is because there system time can be updated from a time source (and might jump back in time). IIRC on cell phones this happens quite often, but it can also happen if your desktop system is connected to a NTP time source. It can also happen if you are not connected to a external time source, for instance due to DST changes.
                This is also mentioned in the documentation for QTime::elapsed(), which is often used for the same purpose. (actually it says that the result is undefined)

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #13

                  Thank you for your comment, but that case is handled. The proposed QTimeSpan handles negative time spans just fine.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DerManu
                    wrote on last edited by
                    #14

                    Voted and Watched.
                    So, after two years, are timespans still not added to Qt? What a shame!

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #15

                      Note that that is also a due to Sean and me not pushing hard enough to get it in after the first attempt.

                      1 Reply Last reply
                      0
                      • U Offline
                        U Offline
                        utcenter
                        wrote on last edited by
                        #16

                        Useful class - voted.

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          JulienMaille
                          wrote on last edited by
                          #17

                          voted too

                          1 Reply Last reply
                          0
                          • R Offline
                            R Offline
                            romanick
                            wrote on last edited by
                            #18

                            It's very needed class!
                            +1

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              Benito1979
                              wrote on last edited by
                              #19

                              I need this class, seems to be very useful!!!

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                Andrey Dyatlov
                                wrote on last edited by
                                #20

                                Hello Andre,
                                I think QTimeSpan class is really a missing part of the Qt Project. Thanks for yours and Sean's efforts!
                                I have a question regarding the legality. Is it possible to use your sources in a commercial project (we use Qt with LGPL) as a part of a code-base (do not incorporate it to the Qt libs) before it becomes a part of Qt officially?
                                Thanks!

                                UPD: English has been slightly improved.

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  andre
                                  wrote on last edited by
                                  #21

                                  I was planning to try and pick this project up again, against Qt 5 and aim for inclusion in 5.2 (finally). I have no objection to others using the code in the meantime, as long as that is in accordance with their usage of Qt.

                                  1 Reply Last reply
                                  0
                                  • L Offline
                                    L Offline
                                    Lykurg
                                    wrote on last edited by
                                    #22

                                    Hi Andre,

                                    What's the current state of QTimeSpan. I could not find any related in Gerrit.

                                    Thanks.

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      andre
                                      wrote on last edited by
                                      #23

                                      There has been no recent active development on it, unfortunately. Life got in the way... Note that the code that is there works just fine.

                                      1 Reply Last reply
                                      0
                                      • TalklessT Offline
                                        TalklessT Offline
                                        Talkless
                                        wrote on last edited by
                                        #24

                                        Please update Qt bug report link to https://bugreports.qt.io/browse/QTBUG-16556

                                        1 Reply Last reply
                                        1

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved