Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
7827a5b7
Kaydet (Commit)
7827a5b7
authored
Eyl 06, 2015
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Closes Issue#22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'.
üst
40dc328c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
8 deletions
+23
-8
datetime.rst
Doc/library/datetime.rst
+12
-7
datetime.py
Lib/datetime.py
+2
-0
datetimetester.py
Lib/test/datetimetester.py
+2
-1
NEWS
Misc/NEWS
+2
-0
_datetimemodule.c
Modules/_datetimemodule.c
+5
-0
No files found.
Doc/library/datetime.rst
Dosyayı görüntüle @
7827a5b7
...
...
@@ -1734,10 +1734,7 @@ made to civil time.
otherwise :exc:`ValueError` is raised.
The *name* argument is optional. If specified it must be a string that
is used as the value returned by the ``tzname(dt)`` method. Otherwise,
``tzname(dt)`` returns a string 'UTCsHH:MM', where s is the sign of
*offset*, HH and MM are two digits of ``offset.hours`` and
``offset.minutes`` respectively.
will be used as the value returned by the :meth:`datetime.tzname` method.
.. versionadded:: 3.2
...
...
@@ -1750,11 +1747,19 @@ made to civil time.
.. method:: timezone.tzname(dt)
Return the fixed value specified when the :class:`timezone` instance is
constructed or a string 'UTCsHH:MM', where s is the sign of
*offset*, HH and MM are two digits of ``offset.hours`` and
Return the fixed value specified when the :class:`timezone` instance
is constructed. If *name* is not provided in the constructor, the
name returned by ``tzname(dt)`` is generated from the value of the
``offset`` as follows. If *offset* is ``timedelta(0)``, the name
is "UTC", otherwise it is a string 'UTC±HH:MM', where ± is the sign
of ``offset``, HH and MM are two digits of ``offset.hours`` and
``offset.minutes`` respectively.
.. versionchanged:: 3.6
Name generated from ``offset=timedelta(0)`` is now plain 'UTC', not
'UTC+00:00'.
.. method:: timezone.dst(dt)
Always returns ``None``.
...
...
Lib/datetime.py
Dosyayı görüntüle @
7827a5b7
...
...
@@ -1920,6 +1920,8 @@ class timezone(tzinfo):
@staticmethod
def
_name_from_offset
(
delta
):
if
not
delta
:
return
'UTC'
if
delta
<
timedelta
(
0
):
sign
=
'-'
delta
=
-
delta
...
...
Lib/test/datetimetester.py
Dosyayı görüntüle @
7827a5b7
...
...
@@ -258,7 +258,8 @@ class TestTimeZone(unittest.TestCase):
with
self
.
assertRaises
(
TypeError
):
self
.
EST
.
dst
(
5
)
def
test_tzname
(
self
):
self
.
assertEqual
(
'UTC+00:00'
,
timezone
(
ZERO
)
.
tzname
(
None
))
self
.
assertEqual
(
'UTC'
,
timezone
.
utc
.
tzname
(
None
))
self
.
assertEqual
(
'UTC'
,
timezone
(
ZERO
)
.
tzname
(
None
))
self
.
assertEqual
(
'UTC-05:00'
,
timezone
(
-
5
*
HOUR
)
.
tzname
(
None
))
self
.
assertEqual
(
'UTC+09:30'
,
timezone
(
9.5
*
HOUR
)
.
tzname
(
None
))
self
.
assertEqual
(
'UTC-00:01'
,
timezone
(
timedelta
(
minutes
=-
1
))
.
tzname
(
None
))
...
...
Misc/NEWS
Dosyayı görüntüle @
7827a5b7
...
...
@@ -17,6 +17,8 @@ Core and Builtins
Library
-------
-
Issue
#
22241
:
timezone
.
utc
name
is
now
plain
'UTC'
,
not
'UTC-00:00'
.
-
Issue
#
23517
:
fromtimestamp
()
and
utcfromtimestamp
()
methods
of
datetime
.
datetime
now
round
microseconds
to
nearest
with
ties
going
away
from
zero
(
ROUND_HALF_UP
),
as
Python
2
and
Python
older
than
3.3
,
instead
of
...
...
Modules/_datetimemodule.c
Dosyayı görüntüle @
7827a5b7
...
...
@@ -3267,6 +3267,11 @@ timezone_str(PyDateTime_TimeZone *self)
Py_INCREF
(
self
->
name
);
return
self
->
name
;
}
if
(
self
==
PyDateTime_TimeZone_UTC
||
(
GET_TD_DAYS
(
self
->
offset
)
==
0
&&
GET_TD_SECONDS
(
self
->
offset
)
==
0
&&
GET_TD_MICROSECONDS
(
self
->
offset
)
==
0
))
return
PyUnicode_FromString
(
"UTC"
);
/* Offset is normalized, so it is negative if days < 0 */
if
(
GET_TD_DAYS
(
self
->
offset
)
<
0
)
{
sign
=
'-'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment