diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2011-01-19 19:53:30 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2011-01-19 19:53:30 (GMT) |
commit | 41a99bc20d378c9bb624a14b0d993be30c7b210d (patch) | |
tree | e59c7611156706eea86bd7f691c577bca8f82ccb /Lib/imaplib.py | |
parent | e47e093f7009ca758f044c52178071b68e48bf2a (diff) | |
download | cpython-41a99bc20d378c9bb624a14b0d993be30c7b210d.zip cpython-41a99bc20d378c9bb624a14b0d993be30c7b210d.tar.gz cpython-41a99bc20d378c9bb624a14b0d993be30c7b210d.tar.bz2 |
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.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 8c14728..4b8e898 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -1312,9 +1312,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 tuple or None if the string has wrong format. """ mo = InternalDate.match(resp) @@ -1381,9 +1382,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)): |