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

Equip QDateTime to distinguish the two passes through an "overlap" hour during a time-zone fall-back, such as the end of DST

    XMLWordPrintable

Details

    • User Story
    • Resolution: Fixed
    • P2: Important
    • 6.7.0 FF
    • None
    • Core: Date/Time
    • All
    • 21
    • Qt6_Foundation_ Sprint 14, Qt6_Foundation_Sprint 15, Foundation Sprint 62, Foundation Sprint 63, Foundation Sprint 64, Foundation Sprint 65, Foundation Sprint 66, Foundation Sprint 67, Foundation Sprint 68, Foundation Sprint 69, Foundation Sprint 70, Foundation Sprint 71, Foundation Sprint 72, Foundation Sprint 73, Foundation Sprint 74, Foundation Sprint 75, Foundation Sprint 76, Foundation Sprint 77, Foundation Sprint 78, Foundations Sprint 79, Foundations Sprint 80, Foundation Sprint 81, Foundation Sprint 82, Foundation Sprint 83, Foundation Sprint 84, Foundation Sprint 85, Foundation Sprint 86, Foundation Sprint 87, Foundation Sprint 88, Foundation Sprint 89, Foundation Sprint 90, Foundation Sprint 91, Foundation Sprint 92, Foundation Sprint 93
    • a49ccc08c (dev)

    Description

      While QDateTime can map a UTC time to a local time, or time in some specified zone, in the overlap period of a zone transition, and will know which repeat of the time it represents (to the degree that it has the right offset from UTC, and will give the right time-zone if toString() is called with a suitable format) , we provide no way to indicate which repeat to use when constructing a time in this interval. The existing implementation will pick one of them; the user can check its isDaylightTime() and addSecs(60 * 60) (or minus that) to fix it up, but there should be a way to tell the constructor which repeat to use, when the specified time happens twice.

      Python's datetime objects handle this using a "fold" parameter, set to 0 to get the first pass and 1 to get the second; this also affects handling of times in the gap when a time-zone transition skips an hour (as at the start of DST); PEP495 specifies the full semantics. In general, fold=0 selects the UTC offset in effect before the transition while fold=1 selects the offset in effect after the transition. I propose to add a parameter with the same semantics.

      Attachments

        Issue Links

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

          Activity

            People

              Eddy Edward Welbourne
              Eddy Edward Welbourne
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 6 weeks
                  6w
                  Remaining:
                  Remaining Estimate - 6 weeks
                  6w
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                  Gerrit Reviews

                    There are no open Gerrit changes