MCPcopy Index your code
hub / github.com/RustPython/RustPython / localtime

Function localtime

Lib/email/utils.py:475–494  ·  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, isdst=None)

Source from the content-addressed store, hash-verified

473#
474
475def localtime(dt=None, isdst=None):
476 """Return local time as an aware datetime object.
477
478 If called without arguments, return current time. Otherwise *dt*
479 argument should be a datetime instance, and it is converted to the
480 local time zone according to the system time zone database. If *dt* is
481 naive (that is, dt.tzinfo is None), it is assumed to be in local time.
482 The isdst parameter is ignored.
483
484 """
485 if isdst is not None:
486 import warnings
487 warnings._deprecated(
488 "The 'isdst' parameter to 'localtime'",
489 message='{name} is deprecated and slated for removal in Python {remove}',
490 remove=(3, 14),
491 )
492 if dt is None:
493 dt = datetime.datetime.now()
494 return dt.astimezone()

Callers

nothing calls this directly

Calls 2

nowMethod · 0.80
astimezoneMethod · 0.80

Tested by

no test coverage detected