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

VTimeZone * VTimeZone::createVTimeZoneByID ( const UnicodeString ID  )  [static]

Create a VTimeZone instance by the time zone ID.

Parameters:
ID The time zone ID, such as America/New_York
Returns:
A VTimeZone object initialized by the time zone ID, or NULL when the ID is unknown. ICU 3.8

Definition at line 1057 of file vtzone.cpp.

References TimeZone::createTimeZone(), TimeZone::getID(), icutzver, NULL, olsonzid, UnicodeString::setTo(), tz, U_SUCCESS, U_ZERO_ERROR, and VTimeZone().

Referenced by vzone_openID().

                                                      {
    VTimeZone *vtz = new VTimeZone();
    vtz->tz = (BasicTimeZone*)TimeZone::createTimeZone(ID);
    vtz->tz->getID(vtz->olsonzid);

    // Set ICU tzdata version
    UErrorCode status = U_ZERO_ERROR;
    UResourceBundle *bundle = NULL;
    const UChar* versionStr = NULL;
    int32_t len;
    bundle = ures_openDirect(NULL, "zoneinfo", &status);
    versionStr = ures_getStringByKey(bundle, "TZVersion", &len, &status);
    if (U_SUCCESS(status)) {
        vtz->icutzver.setTo(versionStr, len);
    }
    ures_close(bundle);
    return vtz;
}


Generated by  Doxygen 1.6.0   Back to index