def _pre_TIMESTAMP_LTZ_to_python(self, value, ctx):
"""
TIMESTAMP LTZ to datetime
This takes consideration of the session parameter TIMEZONE if
available. If not, tzlocal is used
"""
microseconds, fraction_of_nanoseconds = \
self._extract_timestamp(value, ctx)
tzinfo_value = self._get_session_tz()
try:
t0 = ZERO_EPOCH + timedelta(seconds=(microseconds))
t = pytz.utc.localize(t0, is_dst=False).astimezone(tzinfo_value)
return t, fraction_of_nanoseconds
except OverflowError:
logger.debug(
"OverflowError in converting from epoch time to "
"timestamp_ltz: %s(ms). Falling back to use struct_time."
)
return time.gmtime(microseconds), fraction_of_nanoseconds
converter.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录