summaryrefslogtreecommitdiff
path: root/Lib/imaplib.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-01-19 21:48:20 +0000
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-01-19 21:48:20 +0000
commit7e8fbd2b7deb51999908ab0b4f61ac254a9cf81a (patch)
tree424b388bb1255ddc429a6ab848c58782afe8e06d /Lib/imaplib.py
parent63a3f151556e331a8b8608d2f8646b3ecc5d8b0a (diff)
downloadcpython-git-7e8fbd2b7deb51999908ab0b4f61ac254a9cf81a.tar.gz
Merged revisions 88114 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r88114 | alexander.belopolsky | 2011-01-19 14:53:30 -0500 (Wed, 19 Jan 2011) | 5 lines Issue #10934: Fixed and expanded Internaldate2tuple() and Time2Internaldate() documentation. Thanks Joe Peterson for the report and the original patch. ........
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r--Lib/imaplib.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index f66a83bae2..fdae445ae1 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -1321,9 +1321,10 @@ Mon2num = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,
'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
def Internaldate2tuple(resp):
- """Convert IMAP4 INTERNALDATE to UT.
+ """Parse an IMAP4 INTERNALDATE string.
- Returns Python time module tuple.
+ Return corresponding local time. The return value is a
+ time.struct_time instance or None if the string has wrong format.
"""
mo = InternalDate.match(resp)
@@ -1390,9 +1391,14 @@ def ParseFlags(resp):
def Time2Internaldate(date_time):
- """Convert 'date_time' to IMAP4 INTERNALDATE representation.
+ """Convert date_time to IMAP4 INTERNALDATE representation.
- Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'
+ Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'. The
+ date_time argument can be a number (int or float) represening
+ seconds since epoch (as returned by time.time()), a 9-tuple
+ representing local time (as returned by time.localtime()), or a
+ double-quoted string. In the last case, it is assumed to already
+ be in the correct format.
"""
if isinstance(date_time, (int, float)):