def _add_timezone_code(self, raw_config): timezone = raw_config.get(u'timezone', 'Etc/UTC') tz_db = tzinform.TextTimezoneInfoDB() tz_info = tz_db.get_timezone_info(timezone)['utcoffset'].as_hms offset_hour = tz_info[0] offset_minutes = tz_info[1] raw_config[u'XX_timezone_code'] = self._TZ_GIGASET[(offset_hour, offset_minutes)]
def _fix_timezone(self, raw_config): timezone = raw_config.get(u'timezone', 'Greenwich') if timezone not in self._VALID_TZ_GIGASET: tz_db = tzinform.TextTimezoneInfoDB() tz_info = tz_db.get_timezone_info(timezone)['utcoffset'].as_hms offset_hour = tz_info[0] offset_minutes = tz_info[1] raw_config[u'timezone'] = self._FALLBACK_TZ[(offset_hour, offset_minutes)]
def _add_timezone(self, raw_config): timezone = raw_config.get(u'timezone', 'Etc/UTC') tz_db = tzinform.TextTimezoneInfoDB() tz_timezone_info = tz_db.get_timezone_info(timezone) tz_info = tz_timezone_info['utcoffset'].as_hms offset_hour = tz_info[0] offset_minutes = tz_info[1] if (offset_hour, offset_minutes) in self._TZ_INFO: raw_config[u'XX_timezone_code'] = self._TZ_INFO[(offset_hour, offset_minutes)] else: raw_config[u'XX_timezone_code'] = self._TZ_INFO[(-5, 0)]