Logo Search packages:      
Sourcecode: icu version File versions  Download package

int32_t U_EXPORT2 TimeZone::countEquivalentIDs ( const UnicodeString id  )  [static, inherited]

Returns the number of IDs in the equivalency group that includes the given ID. An equivalency group contains zones that have the same GMT offset and rules.

The returned count includes the given ID; it is always >= 1. The given ID must be a system time zone. If it is not, returns zero.

id a system time zone ID
the number of zones in the equivalency group containing 'id', or zero if 'id' is not a valid system ID
See also:
getEquivalentID ICU 2.0

Definition at line 1018 of file timezone.cpp.

References U_SUCCESS, and U_ZERO_ERROR.

    int32_t result = 0;
    UErrorCode ec = U_ZERO_ERROR;
    UResourceBundle res;
    UResourceBundle *top = openOlsonResource(id, res, ec);
    if (U_SUCCESS(ec)) {
        int32_t size = ures_getSize(&res);
        U_DEBUG_TZ_MSG(("cEI: success (size %d, key %s)..\n", size, ures_getKey(&res)));
        if (size == 4 || size == 6) {
            UResourceBundle r;
            ures_getByIndex(&res, size-1, &r, &ec);
            //result = ures_getSize(&r); // doesn't work
            ures_getIntVector(&r, &result, &ec);
            U_DEBUG_TZ_MSG(("ceI: result %d, err %s\n", result, u_errorName(ec)));
    } else {
      U_DEBUG_TZ_MSG(("cEI: fail, %s\n", u_errorName(ec)));
    return result;

Generated by  Doxygen 1.6.0   Back to index