MCPcopy Index your code
hub / github.com/python/cpython / localtime

Function localtime

Lib/email/utils.py:479–490  ·  view source on GitHub ↗

Return local time as an aware datetime object. If called without arguments, return current time. Otherwise *dt* argument should be a datetime instance, and it is converted to the local time zone according to the system time zone database. If *dt* is naive (that is, dt.tzinfo is No

(dt=None)

Source from the content-addressed store, hash-verified

477#
478
479def localtime(dt=None):
480 """Return local time as an aware datetime object.
481
482 If called without arguments, return current time. Otherwise *dt*
483 argument should be a datetime instance, and it is converted to the
484 local time zone according to the system time zone database. If *dt* is
485 naive (that is, dt.tzinfo is None), it is assumed to be in local time.
486
487 """
488 if dt is None:
489 dt = datetime.datetime.now()
490 return dt.astimezone()

Callers

nothing calls this directly

Calls 2

nowMethod · 0.80
astimezoneMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…