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

Method fromutc

Doc/includes/tzinfo_examples.py:24–32  ·  view source on GitHub ↗
(self, when)

Source from the content-addressed store, hash-verified

22class LocalTimezone(dt.tzinfo):
23
24 def fromutc(self, when):
25 assert when.tzinfo is self
26 stamp = (when - dt.datetime(1970, 1, 1, tzinfo=self)) // SECOND
27 args = time.localtime(stamp)[:6]
28 dst_diff = DSTDIFF // SECOND
29 # Detect fold
30 fold = (args == time.localtime(stamp - dst_diff))
31 return dt.datetime(*args, microsecond=when.microsecond,
32 tzinfo=self, fold=fold)
33
34 def utcoffset(self, when):
35 if self._isdst(when):

Callers

nothing calls this directly

Calls 1

datetimeMethod · 0.80

Tested by

no test coverage detected