Server IP : 66.29.132.122 / Your IP : 3.139.104.59 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/opt/imunify360/venv/lib64/python3.11/site-packages/babel/localtime/ |
Upload File : |
""" babel.localtime._fallback ~~~~~~~~~~~~~~~~~~~~~~~~~ Emulated fallback local timezone when all else fails. :copyright: (c) 2013-2023 by the Babel Team. :license: BSD, see LICENSE for more details. """ import datetime import time STDOFFSET = datetime.timedelta(seconds=-time.timezone) DSTOFFSET = datetime.timedelta(seconds=-time.altzone) if time.daylight else STDOFFSET DSTDIFF = DSTOFFSET - STDOFFSET ZERO = datetime.timedelta(0) class _FallbackLocalTimezone(datetime.tzinfo): def utcoffset(self, dt: datetime.datetime) -> datetime.timedelta: if self._isdst(dt): return DSTOFFSET else: return STDOFFSET def dst(self, dt: datetime.datetime) -> datetime.timedelta: if self._isdst(dt): return DSTDIFF else: return ZERO def tzname(self, dt: datetime.datetime) -> str: return time.tzname[self._isdst(dt)] def _isdst(self, dt: datetime.datetime) -> bool: tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = time.mktime(tt) tt = time.localtime(stamp) return tt.tm_isdst > 0