MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / LocalTimezone

Class LocalTimezone

tests/test_code/py/pytz/reference.py:54–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52
53# A class capturing the platform's idea of local time.
54class LocalTimezone(tzinfo):
55
56 def utcoffset(self, dt):
57 if self._isdst(dt):
58 return DSTOFFSET
59 else:
60 return STDOFFSET
61
62 def dst(self, dt):
63 if self._isdst(dt):
64 return DSTDIFF
65 else:
66 return ZERO
67
68 def tzname(self, dt):
69 return _time.tzname[self._isdst(dt)]
70
71 def _isdst(self, dt):
72 tt = (dt.year, dt.month, dt.day,
73 dt.hour, dt.minute, dt.second,
74 dt.weekday(), 0, -1)
75 stamp = _time.mktime(tt)
76 tt = _time.localtime(stamp)
77 return tt.tm_isdst > 0
78
79Local = LocalTimezone()
80

Callers 1

reference.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected