Return a list of all time zones known to the system.
343897
def list_timezones():
    """"""
    l = []
    for i in xrange(parentsize):
        l.append(_winreg.EnumKey(tzparent, i))
    return l
42314
async def all(
            self, *, details: bool = False,
            include_inactive: bool = False) -> list:
        """"""
        endpoint = 'zone'
        if details:
            endpoint += '/properties'
        data = await self._request('get', endpoint)
        return [z for z in data['zones'] if include_inactive or z['active']]
973703
protected Collection<VTimezone> getTimezoneComponents() {
		if (globalTimezone != null) {
			VTimezone component = globalTimezone.getComponent();
			return (component == null) ? Collections.<VTimezone> emptyList() : Arrays.asList(component);
		}

		return tzinfo.getComponents();
	}
1171795
def get_localzone():
    """"""
    global _cache_tz
    if _cache_tz is None:
        _cache_tz = pytz.timezone(get_localzone_name())

    utils.assert_tz_offset(_cache_tz)
    return _cache_tz
416081
function get_timezones() {
		$utc = new \DateTimeZone('UTC');
		$dt = new \DateTime('now', $utc);
		$timezones = array();
		foreach(\DateTimeZone::listIdentifiers() as $tz) {
	    $current_tz = new \DateTimeZone($tz);
	    $offset =  $current_tz->getOffset($dt);
	    $transition =  $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp());
	    $abbr = $transition[0]['abbr'];
			$timezones[$tz]= $abbr. ' '. $this->formatOffset($offset);
		}
		return $timezones;
	}
613833
def get_timezone() -> Tuple[datetime.tzinfo, str]:
    """"""
    dt = get_datetime_now().astimezone()
    tzstr = dt.strftime("%z")
    tzstr = tzstr[:-2] + ":" + tzstr[-2:]
    return dt.tzinfo, tzstr
307270
def get_data_with_timestamps(self):
        
        result = []
        for t, d in zip(self.timestamps, self.data_points):
            result.append(t, round(d, self.lr))
        return result
787456
public static function get_list_of_timezones($currentvalue = null, $include99 = false) {
        self::init_zones();

        // Localise first.
        $timezones = array();
        foreach (self::$goodzones as $tzkey => $ignored) {
            $timezones[$tzkey] = self::get_localised_timezone($tzkey);
        }
        core_collator::asort($timezones);

        // Add '99' if requested.
        if ($include99 or $currentvalue == 99) {
            $timezones['99'] = self::get_localised_timezone('99');
        }

        if (!isset($currentvalue) or isset($timezones[$currentvalue])) {
            return $timezones;
        }

        if (is_numeric($currentvalue)) {
            // UTC offset.
            if ($currentvalue == 0) {
                $a = 'UTC';
            } else {
                $modifier = ($currentvalue > 0) ? '+' : '';
                $a = 'UTC' . $modifier . number_format($currentvalue, 1);
            }
            $timezones[$currentvalue] = get_string('timezoneinvalid', 'core_admin', $a);
        } else {
            // Some string we don't recognise.
            $timezones[$currentvalue] = get_string('timezoneinvalid', 'core_admin', $currentvalue);
        }

        return $timezones;
    }
783447
def get_all_zones(self):
        """"""
        zones = {'HostedZones': []}

        new_zones = self.route53.list_hosted_zones(MaxItems='100')
        while new_zones['IsTruncated']:
            zones['HostedZones'] += new_zones['HostedZones']
            new_zones = self.route53.list_hosted_zones(Marker=new_zones['NextMarker'], MaxItems='100')

        zones['HostedZones'] += new_zones['HostedZones']
        return zones
415770
private function getTimeZoneList(): array
    {
        if (count($this->timeZoneList) === 0) {
            $this->timeZoneList = DateTimeUtils::getTimeZoneList();
        }

        return $this->timeZoneList;
    }
1190752
def get_choices(timezones, grouped=False):
    """"""

    # Created a namedtuple to store the "key" for the choices_dict
    TZOffset = namedtuple('TZOffset', 'value offset_string')

    choices_dict = defaultdict(list)

    # Iterate through the timezones and populate the timezone choices
    for tz in iter(timezones):
        # Retrieve a datetime object in this time zone
        now = datetime.now(pytz.timezone(tz))

        # Retrieve the timezone offset ("-0500" / "+0500")
        offset = now.strftime("%z")

        # Retrieve the offset string ("GMT-12:00" / "GMT+12:00")
        timezone_offset_string = 'GMT{plus_minus}{hours}:{minutes}'.format(
            **TIMEZONE_OFFSET_REGEX.match(offset).groupdict()
        )

        if not grouped:
            # Format the timezone display string
            display_string = '({timezone_offset_string}) {tz}'.format(
                timezone_offset_string=timezone_offset_string,
                tz=tz,
            )
        else:
            display_string = tz

        choices_dict[
            TZOffset(value=int(offset), offset_string=timezone_offset_string)
        ].append(
            (tz, display_string)
        )

    choices = []

    for tz_offset in sorted(choices_dict, key=attrgetter('value')):
        if not grouped:
            choices.extend(
                tuple(choices_dict[tz_offset])
            )
        else:
            choices.append(
                (
                    tz_offset.offset_string,
                    tuple(choices_dict[tz_offset])
                )
            )

    # Cast the timezone choices to a tuple and return
    return tuple(choices)
896597
async def get_timezone(self) -> Optional[tzinfo]:
        

        u = await self._get_user()
        diff = float(u.get('timezone', 0)) * 3600.0

        return tz.tzoffset('ITC', diff)
808671
def ListTimeZones(self):
    """"""
    max_length = 0
    for timezone_name in pytz.all_timezones:
      if len(timezone_name) > max_length:
        max_length = len(timezone_name)

    utc_date_time = datetime.datetime.utcnow()

    table_view = views.ViewsFactory.GetTableView(
        self._views_format_type, column_names=['Timezone', 'UTC Offset'],
        title='Zones')
    for timezone_name in pytz.all_timezones:
      try:
        local_timezone = pytz.timezone(timezone_name)
      except AssertionError as exception:
        logger.error((
            'Unable to determine information about timezone: {0:s} with '
            'error: {1!s}').format(timezone_name, exception))
        continue

      local_date_string = '{0!s}'.format(
          local_timezone.localize(utc_date_time))
      if '+' in local_date_string:
        _, _, diff = local_date_string.rpartition('+')
        diff_string = '+{0:s}'.format(diff)
      else:
        _, _, diff = local_date_string.rpartition('-')
        diff_string = '-{0:s}'.format(diff)

      table_view.AddRow([timezone_name, diff_string])

    table_view.Write(self._output_writer)
1056805
def iso8601(self):
        """"""
        # Get a timezone-naive datetime.
        dt = self.datetime(naive=True)
        return '{}Z'.format(dt.isoformat())
613452
public function getTimezonesList()
    {
        if (!SettingsServer::isTimezoneSupportEnabled()) {
            return array('UTC' => $this->getTimezonesListUTCOffsets());
        }

        $countries = StaticContainer::get('Piwik\Intl\Data\Provider\RegionDataProvider')->getCountryList();

        $return = array();
        $continents = array();
        foreach ($countries as $countryCode => $continentCode) {
            $countryCode = strtoupper($countryCode);
            $timezones = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $countryCode);
            foreach ($timezones as $timezone) {
                if (!isset($continents[$continentCode])) {
                    $continents[$continentCode] = Piwik::translate('Intl_Continent_' . $continentCode);
                }
                $continent = $continents[$continentCode];

                $return[$continent][$timezone] = $this->getTimezoneName($timezone, $countryCode, count($timezones) > 1);
            }
        }

        // Sort by continent name and then by country name.
        ksort($return);
        foreach ($return as $continent => $countries) {
            asort($return[$continent]);
        }

        $return['UTC'] = $this->getTimezonesListUTCOffsets();
        return $return;
    }
205241
def _to_timezone(self, dt):
        """"""
        tz = self._get_tz()
        utc_dt = pytz.utc.localize(dt)
        return utc_dt.astimezone(tz)
1299984
def _convertTZ(self):
        """"""
        tz = timezone.get_current_timezone()
        dtstart = self['DTSTART']
        dtend   = self['DTEND']
        if dtstart.zone() == "UTC":
            dtstart.dt = dtstart.dt.astimezone(tz)
        if dtend.zone() == "UTC":
            dtend.dt = dtend.dt.astimezone(tz)