def datetime_from_localtime_timestruct(timestruct): """Convert a local-time time struct to a UTC date-time object The input is assumed to be in local time. The resulting :class:`~datetime.datetime` is in UTC and is time-zone-aware. :param timestruct: A time struct. :type timestruct: :class:`time.struct_time` :rtype: :class:`datetime.datetime` """ return datetime_from_unixtime(_unixtime_from_localtime_timestruct (timestruct))
def _isdst(self, dt): timestruct = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, 0) unixtime = _unixtime_from_localtime_timestruct(timestruct) timestruct = _localtime_timestruct_from_unixtime(unixtime) return timestruct.tm_isdst > 0