TimeZone* U_EXPORT2 TimeZone::createTimeZone(const UnicodeString& ID) { /* We first try to lookup the zone ID in our system list. If this * fails, we try to parse it as a custom string GMT[+-]hh:mm. If * all else fails, we return GMT, which is probably not what the * user wants, but at least is a functioning TimeZone object. * * We cannot return NULL, because that would break compatibility * with the JDK. */ TimeZone* result = createSystemTimeZone(ID); if (result == 0) { U_DEBUG_TZ_MSG(("failed to load system time zone with id - falling to custom")); result = createCustomTimeZone(ID); } if (result == 0) { U_DEBUG_TZ_MSG(("failed to load time zone with id - falling to GMT")); const TimeZone* temptz = getGMT(); if (temptz == NULL) { result = NULL; } else { result = temptz->clone(); } } return result; }
TimeZone* TimeZone::createTimeZone(const UnicodeString& ID) { /* We first try to lookup the zone ID in our system list. If this * fails, we try to parse it as a custom string GMT[+-]hh:mm. If * all else fails, we return GMT, which is probably not what the * user wants, but at least is a functioning TimeZone object. */ TimeZone* result = 0; if (haveZoneData()) { result = createSystemTimeZone(ID); } if (result == 0) { result = createCustomTimeZone(ID); } if (result == 0) { result = getGMT()->clone(); } return result; }