presto-spi/src/main/java/io/prestosql/spi/type/TimeZoneKey.java/TimeZoneKey/normalizeZoneId
class TimeZoneKey:    private static String normalizeZoneId(String originalZoneId)
    {
        String zoneId = originalZoneId.toLowerCase(ENGLISH);

        boolean startsWithEtc = zoneId.startsWith("etc/");
        if (startsWithEtc) {
            zoneId = zoneId.substring(4);
        }

        if (isUtcEquivalentName(zoneId)) {
            return "utc";
        }

        //
        // Normalize fixed offset time zones.
        //

        // In some zones systems, these will start with UTC, GMT or UT.
        int length = zoneId.length();
        boolean startsWithEtcGmt = false;
        if (length > 3 && (zoneId.startsWith("utc") || zoneId.startsWith("gmt"))) {
            if (startsWithEtc && zoneId.startsWith("gmt")) {
                startsWithEtcGmt = true;
            }
            zoneId = zoneId.substring(3);
            length = zoneId.length();
        }
        else if (length > 2 && zoneId.startsWith("ut")) {
            zoneId = zoneId.substring(2);
            length = zoneId.length();
        }

        // (+/-)00:00 is UTC
        if ("+00:00".equals(zoneId) || "-00:00".equals(zoneId)) {
            return "utc";
        }

        // if zoneId matches XXX:XX, it is likely +HH:mm, so just return it
        // since only offset time zones will contain a `:` character
        if (length == 6 && zoneId.charAt(3) == ':') {
            return zoneId;
        }

        //
        // Rewrite (+/-)H[H] to (+/-)HH:00
        //
        if (length != 2 && length != 3) {
            return originalZoneId;
        }

        // zone must start with a plus or minus sign
        char signChar = zoneId.charAt(0);
        if (signChar != '+' && signChar != '-') {
            return originalZoneId;
        }
        if (startsWithEtcGmt) {
            // Flip sign for Etc/GMT(+/-)H[H]
            signChar = signChar == '-' ? '+' : '-';
        }

        // extract the tens and ones characters for the hour
        char hourTens;
        char hourOnes;
        if (length == 2) {
            hourTens = '0';
            hourOnes = zoneId.charAt(1);
        }
        else {
            hourTens = zoneId.charAt(1);
            hourOnes = zoneId.charAt(2);
        }

        // do we have a valid hours offset time zone?
        if (!isDigit(hourTens) || !isDigit(hourOnes)) {
            return originalZoneId;
        }

        // is this offset 0 (e.g., UTC)?
        if (hourTens == '0' && hourOnes == '0') {
            return "utc";
        }

        return "" + signChar + hourTens + hourOnes + ":00";
    }