From f9bd9141c5b608cdd1149b0f8fa874debcf1e6fa Mon Sep 17 00:00:00 2001 From: Alexander Belopolsky Date: Wed, 22 Aug 2012 23:02:36 -0400 Subject: Issue #665194: Added a small optimization --- Lib/email/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/email/utils.py b/Lib/email/utils.py index f32cdd9..73bc348 100644 --- a/Lib/email/utils.py +++ b/Lib/email/utils.py @@ -386,7 +386,7 @@ def localtime(dt=None, isdst=-1): """ if dt is None: - dt = datetime.datetime.now(datetime.timezone.utc) + return datetime.datetime.now(datetime.timezone.utc).astimezone() if dt.tzinfo is not None: return dt.astimezone() # We have a naive datetime. Convert to a (localtime) timetuple and pass to -- cgit v0.12