@@ -1071,16 +1071,20 @@ Instance methods:
10711071
10721072 If :attr: `.tzinfo ` is ``None ``, returns ``None ``, else returns
10731073 ``self.tzinfo.utcoffset(self) ``, and raises an exception if the latter doesn't
1074- return ``None ``, or a :class: `timedelta ` object representing a whole number of
1075- minutes with magnitude less than one day.
1074+ return ``None `` or a :class: `timedelta ` object with magnitude less than one day.
1075+
1076+ .. versionchanged :: 3.7
1077+ The UTC offset is not restricted to a whole number of minutes.
10761078
10771079
10781080.. method :: datetime.dst()
10791081
10801082 If :attr: `.tzinfo ` is ``None ``, returns ``None ``, else returns
10811083 ``self.tzinfo.dst(self) ``, and raises an exception if the latter doesn't return
1082- ``None ``, or a :class: `timedelta ` object representing a whole number of minutes
1083- with magnitude less than one day.
1084+ ``None `` or a :class: `timedelta ` object with magnitude less than one day.
1085+
1086+ .. versionchanged :: 3.7
1087+ The DST offset is not restricted to a whole number of minutes.
10841088
10851089
10861090.. method :: datetime.tzname()
@@ -1562,17 +1566,20 @@ Instance methods:
15621566
15631567 If :attr: `.tzinfo ` is ``None ``, returns ``None ``, else returns
15641568 ``self.tzinfo.utcoffset(None) ``, and raises an exception if the latter doesn't
1565- return ``None `` or a :class: `timedelta ` object representing a whole number of
1566- minutes with magnitude less than one day.
1569+ return ``None `` or a :class: `timedelta ` object with magnitude less than one day.
1570+
1571+ .. versionchanged :: 3.7
1572+ The UTC offset is not restricted to a whole number of minutes.
15671573
15681574
15691575.. method :: time.dst()
15701576
15711577 If :attr: `.tzinfo ` is ``None ``, returns ``None ``, else returns
15721578 ``self.tzinfo.dst(None) ``, and raises an exception if the latter doesn't return
1573- ``None ``, or a :class: `timedelta ` object representing a whole number of minutes
1574- with magnitude less than one day.
1579+ ``None ``, or a :class: `timedelta ` object with magnitude less than one day.
15751580
1581+ .. versionchanged :: 3.7
1582+ The DST offset is not restricted to a whole number of minutes.
15761583
15771584.. method :: time.tzname()
15781585
@@ -1641,13 +1648,14 @@ Example:
16411648
16421649.. method :: tzinfo.utcoffset(dt)
16431650
1644- Return offset of local time from UTC, in minutes east of UTC. If local time is
1651+ Return offset of local time from UTC, as a :class: `timedelta ` object that is
1652+ positive east of UTC. If local time is
16451653 west of UTC, this should be negative. Note that this is intended to be the
16461654 total offset from UTC; for example, if a :class: `tzinfo ` object represents both
16471655 time zone and DST adjustments, :meth: `utcoffset ` should return their sum. If
16481656 the UTC offset isn't known, return ``None ``. Else the value returned must be a
1649- :class: `timedelta ` object specifying a whole number of minutes in the range
1650- -1439 to 1439 inclusive (1440 = 24 \* 60; the magnitude of the offset must be less
1657+ :class: `timedelta ` object strictly between `` -timedelta(hours=24) `` and
1658+ `` timedelta(hours=24) `` ( the magnitude of the offset must be less
16511659 than one day). Most implementations of :meth: `utcoffset ` will probably look
16521660 like one of these two::
16531661
@@ -1660,10 +1668,14 @@ Example:
16601668 The default implementation of :meth: `utcoffset ` raises
16611669 :exc: `NotImplementedError `.
16621670
1671+ .. versionchanged :: 3.7
1672+ The UTC offset is not restricted to a whole number of minutes.
1673+
16631674
16641675.. method :: tzinfo.dst(dt)
16651676
1666- Return the daylight saving time (DST) adjustment, in minutes east of UTC, or
1677+ Return the daylight saving time (DST) adjustment, as a :class: `timedelta `
1678+ object or
16671679 ``None `` if DST information isn't known. Return ``timedelta(0) `` if DST is not
16681680 in effect. If DST is in effect, return the offset as a :class: `timedelta ` object
16691681 (see :meth: `utcoffset ` for details). Note that DST offset, if applicable, has
@@ -1708,6 +1720,9 @@ Example:
17081720
17091721 The default implementation of :meth: `dst ` raises :exc: `NotImplementedError `.
17101722
1723+ .. versionchanged :: 3.7
1724+ The DST offset is not restricted to a whole number of minutes.
1725+
17111726
17121727.. method :: tzinfo.tzname(dt)
17131728
@@ -1887,21 +1902,27 @@ made to civil time.
18871902 The *offset * argument must be specified as a :class: `timedelta `
18881903 object representing the difference between the local time and UTC. It must
18891904 be strictly between ``-timedelta(hours=24) `` and
1890- ``timedelta(hours=24) `` and represent a whole number of minutes,
1891- otherwise :exc: `ValueError ` is raised.
1905+ ``timedelta(hours=24) ``, otherwise :exc: `ValueError ` is raised.
18921906
18931907 The *name * argument is optional. If specified it must be a string that
18941908 will be used as the value returned by the :meth: `datetime.tzname ` method.
18951909
18961910 .. versionadded :: 3.2
18971911
1912+ .. versionchanged :: 3.7
1913+ The UTC offset is not restricted to a whole number of minutes.
1914+
1915+
18981916.. method :: timezone.utcoffset(dt)
18991917
19001918 Return the fixed value specified when the :class: `timezone ` instance is
19011919 constructed. The *dt * argument is ignored. The return value is a
19021920 :class: `timedelta ` instance equal to the difference between the
19031921 local time and UTC.
19041922
1923+ .. versionchanged :: 3.7
1924+ The UTC offset is not restricted to a whole number of minutes.
1925+
19051926.. method :: timezone.tzname(dt)
19061927
19071928 Return the fixed value specified when the :class: `timezone ` instance
@@ -2025,8 +2046,8 @@ format codes.
20252046| | number, zero-padded on the | 999999 | |
20262047| | left. | | |
20272048+-----------+--------------------------------+------------------------+-------+
2028- | ``%z `` | UTC offset in the form +HHMM | (empty), +0000, -0400, | \( 6) |
2029- | | or - HHMM (empty string if the | +1030 | |
2049+ | ``%z `` | UTC offset in the form | (empty), +0000, -0400, | \( 6) |
2050+ | | ± HHMM[SS] (empty string if the | +1030 | |
20302051| | object is naive). | | |
20312052+-----------+--------------------------------+------------------------+-------+
20322053| ``%Z `` | Time zone name (empty string | (empty), UTC, EST, CST | |
@@ -2139,12 +2160,19 @@ Notes:
21392160 For an aware object:
21402161
21412162 ``%z ``
2142- :meth: `utcoffset ` is transformed into a 5-character string of the form
2143- + HHMM or -HHMM , where HH is a 2-digit string giving the number of UTC
2163+ :meth: `utcoffset ` is transformed into a string of the form
2164+ ± HHMM[SS[.uuuuuu]] , where HH is a 2-digit string giving the number of UTC
21442165 offset hours, and MM is a 2-digit string giving the number of UTC offset
2145- minutes. For example, if :meth: `utcoffset ` returns
2146- ``timedelta(hours=-3, minutes=-30) ``, ``%z `` is replaced with the string
2147- ``'-0330' ``.
2166+ minutes, SS is a 2-digit string string giving the number of UTC offset
2167+ seconds and uuuuuu is a 2-digit string string giving the number of UTC
2168+ offset microseconds. The uuuuuu part is omitted when the offset is a
2169+ whole number of minutes and both the uuuuuu and the SS parts are omitted
2170+ when the offset is a whole number of minutes. For example, if
2171+ :meth: `utcoffset ` returns ``timedelta(hours=-3, minutes=-30) ``, ``%z `` is
2172+ replaced with the string ``'-0330' ``.
2173+
2174+ .. versionchanged :: 3.7
2175+ The UTC offset is not restricted to a whole number of minutes.
21482176
21492177 ``%Z ``
21502178 If :meth: `tzname ` returns ``None ``, ``%Z `` is replaced by an empty
0 commit comments