Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5bdd618a
Commit
5bdd618a
authored
Jan 05, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for time.struct_time in addition to tuples. Use 3 characters
for zone hours. Fixes #499169.
parent
72ed6884
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
Lib/imaplib.py
Lib/imaplib.py
+5
-5
Lib/test/test_imaplib.py
Lib/test/test_imaplib.py
+14
-0
No files found.
Lib/imaplib.py
View file @
5bdd618a
...
...
@@ -1069,12 +1069,12 @@ def Time2Internaldate(date_time):
Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'
"""
dttype
=
type
(
date_time
)
if
dttype
is
type
(
1
)
or
dttype
is
type
(
1.1
):
if
isinstance
(
date_time
,
int
)
or
isinstance
(
date_time
,
float
):
tt
=
time
.
localtime
(
date_time
)
elif
dttype
is
type
(()):
elif
isinstance
(
date_time
,
tuple
)
or
\
isinstance
(
date_time
,
time
.
struct_time
):
tt
=
date_time
elif
dttype
is
type
(
""
):
elif
isinstance
(
date_time
,
str
):
return
date_time
# Assume in correct format
else
:
raise
ValueError
...
...
@@ -1085,7 +1085,7 @@ def Time2Internaldate(date_time):
zone
=
-
time
.
altzone
else
:
zone
=
-
time
.
timezone
return
'"'
+
dt
+
" %+0
2
d%02d"
%
divmod
(
zone
/
60
,
60
)
+
'"'
return
'"'
+
dt
+
" %+0
3
d%02d"
%
divmod
(
zone
/
60
,
60
)
+
'"'
...
...
Lib/test/test_imaplib.py
0 → 100644
View file @
5bdd618a
from
test_support
import
verify
,
verbose
import
imaplib
import
time
# We can check only that it successfully produces a result,
# not the correctness of the result itself, since the result
# depends on the timezone the machine is in.
timevalues
=
[
2000000000
,
2000000000.0
,
time
.
localtime
(
2000000000
),
"18-May-2033 05:33:20 +0200"
]
for
t
in
timevalues
:
imaplib
.
Time2Internaldate
(
t
)
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