Return a list of all time zones known to the system.
772331
def list():
        """"""
        handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
        tzkey = winreg.OpenKey(handle, TZKEYNAME)
        result = [winreg.EnumKey(tzkey, i)
                  for i in range(winreg.QueryInfoKey(tzkey)[0])]
        tzkey.Close()
        handle.Close()
        return result
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;
	}
1271524
public ResultsMap<String, List<String>> getTimezones() throws MovieDbException {
        URL url = new ApiUrl(apiKey, MethodBase.TIMEZONES).subMethod(MethodSub.LIST).buildUrl();
        String webpage = httpTools.getRequest(url);

        List<Map<String, List<String>>> tzList;
        try {
            tzList = MAPPER.readValue(webpage, new TypeReference<List<Map<String, List<String>>>>() {
            });
        } catch (IOException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get timezone list", url, ex);
        }

        ResultsMap<String, List<String>> timezones = new ResultsMap<>();

        for (Map<String, List<String>> tzMap : tzList) {
            for (Map.Entry<String, List<String>> x : tzMap.entrySet()) {
                timezones.put(x.getKey(), x.getValue());
            }
        }

        return timezones;
    }
958883
private static function getTimezones(): array
    {
        $timezones = [];

        foreach (\DateTimeZone::listIdentifiers() as $timezone) {
            $parts = explode('/', $timezone);

            if (\count($parts) > 2) {
                $region = $parts[0];
                $name = $parts[1].' - '.$parts[2];
            } elseif (\count($parts) > 1) {
                $region = $parts[0];
                $name = $parts[1];
            } else {
                $region = 'Other';
                $name = $parts[0];
            }

            $timezones[$region][str_replace('_', ' ', $name)] = $timezone;
        }

        return $timezones;
    }
469043
def local_timezone(value):
    """"""
    if hasattr(value, "tzinfo") and value.tzinfo is None:
        return value.replace(tzinfo=dateutil.tz.tzlocal())
    return value
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
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
470128
def timezone(self):
        
        if self._tz is None:
            # GET CENTROID FROM GSSHA GRID
            cen_lat, cen_lon = self.centerLatLon()
            # update time zone
            tf = TimezoneFinder()
            tz_name = tf.timezone_at(lng=cen_lon, lat=cen_lat)

            self._tz = timezone(tz_name)
        return self._tz
1056805
def iso8601(self):
        """"""
        # Get a timezone-naive datetime.
        dt = self.datetime(naive=True)
        return '{}Z'.format(dt.isoformat())
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
205241
def _to_timezone(self, dt):
        """"""
        tz = self._get_tz()
        utc_dt = pytz.utc.localize(dt)
        return utc_dt.astimezone(tz)
1201506
def timezones_choices():
    
    utcnow = pytz.utc.localize(datetime.utcnow())
    locale = _get_locale()
    for tz in sorted(pytz.common_timezones):
        tz = get_timezone(tz)
        now = tz.normalize(utcnow.astimezone(tz))
        label = "({}) {}".format(get_timezone_gmt(now, locale=locale), tz.zone)
        yield (tz, label)
316482
public function getTimezones()
    {
        static $cache = [];
        $locale = Localization::activeLocale();
        if (array_key_exists($locale, $cache)) {
            $result = $cache[$locale];
        } else {
            $result = [];
            $continentNames = [
                'Africa' => \Punic\Territory::getName('002'),
                'Asia' => \Punic\Territory::getName('142'),
                'America' => \Punic\Territory::getName('019'),
                'Antarctica' => \Punic\Territory::getName('AQ'),
                'Arctic' => t('Arctic'),
                'Atlantic' => t('Atlantic Ocean'),
                'Australia' => \Punic\Territory::getName('AU'),
                'Europe' => \Punic\Territory::getName('150'),
                'Indian' => t('Indian Ocean'),
                'Pacific' => t('Pacific Ocean'),
            ];
            foreach (\DateTimeZone::listIdentifiers() as $timezoneID) {
                switch ($timezoneID) {
                    case 'UTC':
                    case 'GMT':
                        $timezoneName = t(/*i18n: %s is an acronym like UTC, GMT, ... */'Greenwich Mean Time (%s)', $timezoneID);
                        break;
                    default:
                        $chunks = explode('/', $timezoneID);
                        if (array_key_exists($chunks[0], $continentNames)) {
                            $chunks[0] = $continentNames[$chunks[0]];
                        }
                        if (count($chunks) > 0) {
                            $city = Calendar::getTimezoneExemplarCity($timezoneID, false);
                            if (!strlen($city)) {
                                switch ($timezoneID) {
                                    case 'America/Fort_Nelson':
                                        $city = tc(/*i18n: Canadian territory */'Territory', 'Fort Nelson');
                                        break;
                                    case 'America/Montreal':
                                        $city = tc(/*i18n: Canadian city */'Territory', 'Montreal');
                                        break;
                                    case 'America/Shiprock':
                                        $city = tc(/*i18n: Territory in New Mexico (USA) */'Territory', 'Shiprock');
                                        break;
                                    case 'Antarctica/South_Pole':
                                        $city = tc(/*i18n: The South Pole */'Territory', 'South Pole');
                                        break;
                                    case 'Asia/Atyrau':
                                        $city = tc(/*i18n: Kazakh territory */'Territory', 'Atyrau');
                                        break;
                                    case 'Asia/Barnaul':
                                        $city = tc(/*i18n: Russian city */'Territory', 'Barnaul');
                                        break;
                                    case 'Asia/Famagusta':
                                        $city = tc(/*i18n: City in Cyprus Island */'Territory', 'Famagusta');
                                        break;
                                    case 'Asia/Tomsk':
                                        $city = tc(/*i18n: Russian city */'Territory', 'Tomsk');
                                        break;
                                    case 'Asia/Yangon':
                                        $city = tc(/*i18n: Burmese city */'Territory', 'Yangon');
                                        break;
                                    case 'Europe/Astrakhan':
                                        $city = tc(/*i18n: Russian city */'Territory', 'Astrakhan');
                                        break;
                                    case 'Europe/Kirov':
                                        $city = tc(/*i18n: Russian city */'Territory', 'Kirov');
                                        break;
                                    case 'Europe/Saratov':
                                        $city = tc(/*i18n: Russian city */'Territory', 'Saratov');
                                        break;
                                    case 'Europe/Ulyanovsk':
                                        $city = tc(/*i18n: Russian city */'Territory', 'Ulyanovsk');
                                        break;
                                }
                            }
                            if (strlen($city)) {
                                $chunks = [$chunks[0], $city];
                            }
                        }
                        $timezoneName = implode('/', $chunks);
                        break;
                }
                $result[$timezoneID] = $timezoneName;
            }
            $comparer = new Comparer();
            $comparer->sort($result, true);
            $cache[$locale] = $result;
        }

        return $result;
    }
1207692
def _detect_timezone_etc_localtime():
  """"""
  matches = []
  if os.path.exists("/etc/localtime"):
    f = open("/etc/localtime", "rb")
    localtime = pytz.tzfile.build_tzinfo("/etc/localtime", f)
    f.close()

    # We want to match against the local database because /etc/localtime will
    # be copied from that. Once we have found a name for /etc/localtime, we can
    # use the name to get the "same" timezone from the inbuilt pytz database.

    tzdatabase = _load_local_tzinfo()
    if tzdatabase:
      tznames = tzdatabase.keys()
      tzvalues = tzdatabase.__getitem__
    else:
      tznames = pytz.all_timezones
      tzvalues = _tzinfome

    # See if we can find a "Human Name" for this..
    for tzname in tznames:
      tz = tzvalues(tzname)

      if dir(tz) != dir(localtime):
        continue

      for attrib in dir(tz):
        # Ignore functions and specials
        if callable(getattr(tz, attrib)) or attrib.startswith("__"):
          continue

        # This will always be different
        if attrib == "zone" or attrib == "_tzinfos":
          continue

        if getattr(tz, attrib) != getattr(localtime, attrib):
          break

      # We get here iff break didn't happen, i.e. no meaningful attributes
      # differ between tz and localtime
      else:
        # Try and get a timezone from pytz which has the same name as the zone
        # which matches in the local database.
        if tzname not in pytz.all_timezones:
          warnings.warn("Skipping %s because not in pytz database." % tzname)
          continue

        matches.append(_tzinfome(tzname))

    matches.sort(key=lambda x: x.zone)

    if len(matches) == 1:
      return matches[0]

    if len(matches) > 1:
      warnings.warn("We detected multiple matches for your /etc/localtime. "
                    "(Matches where %s)" % matches)
      return matches[0]
    else:
      warnings.warn("We detected no matches for your /etc/localtime.")

    # Register /etc/localtime as the timezone loaded.
    pytz._tzinfo_cache["/etc/localtime"] = localtime
    return localtime
286784
def get_local_tzone():
    """"""
    if localtime().tm_isdst:
        if altzone < 0:
            tzone = '+' + \
                    str(int(float(altzone) / 60 // 60)).rjust(2,
                            '0') + \
                            str(int(float(
                                altzone) / 60 % 60)).ljust(2, '0')
        else:
            tzone = '-' + \
                    str(int(float(altzone) / 60 // 60)).rjust(2,
                            '0') + \
                            str(int(float(
                                altzone) / 60 % 60)).ljust(2, '0')
    else:
        if altzone < 0:
            tzone = \
                    '+' + str(int(float(timezone) / 60 // 60)).rjust(2,
                            '0') + \
                            str(int(float(
                                timezone) / 60 % 60)).ljust(2, '0')
        else:
            tzone = \
                    '-' + str(int(float(timezone) / 60 // 60)).rjust(2,
                            '0') + \
                            str(int(float(
                                timezone) / 60 % 60)).ljust(2, '0')

    return tzone
1359205
private List<TimeZoneInfo> parseTimeZoneInfos(String code, JsonObject root) {
    JsonObject node = resolve(root, "main", code, "dates", "timeZoneNames", "zone");
    return parseTimeZoneInfo(node, Collections.emptyList());
  }
353258
public List<LocalTime> asList() {
        List<LocalTime> times = new ArrayList<>();
        for (LocalTime time : this) {
            times.add(time);
        }
        return times;
    }