Patched documentation for Internaldate2tuple() to correctly state it returns local time. Also, Time2Internaldate() (its inverse) did not state that it needs local time as input, so patched this as well. Patches for 3.2 and 2.7 are attached.
It makes sense that Internaldate2tuple() returns local time because timetuple (with its tm_isdst flag) strongly suggests local time. (See also issue 9004.) If UTC or any other timezone time is needed, it would be best to provide a function that would return an aware datetime object. I made some changes to Joe's patch in attached diff. I would appreciate another pair of eyes to look at it before I commit.
Hey Alexander, Looks great. Just a few small things: * In hunk 2 of the imaplib.rst file patch section, insert word "to" (i.e. "Convert *date_time* to an IMAP4 ``INTERNALDATE`` representation.") * Two lines, down there's only one space at end of sentence: "double-quotes). The" (all other places have 2 spaces). * In first hunk of imaplib.py patch section, there is a period that does not belong after "tuple": "time.struct_time tuple. or None" That's all I saw! Thanks for expanding on the doc!