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

TimeZone *U_EXPORT2 TimeZone::createDefault ( void   )  [static, inherited]

Creates a new copy of the default TimeZone for this host. Unless the default time zone has already been set using adoptDefault() or setDefault(), the default is determined by querying the system using methods in TPlatformUtilities. If the system routines fail, or if they specify a TimeZone or TimeZone offset which is not recognized, the TimeZone indicated by the ID kLastResortID is instantiated and made the default.

Returns:
A default TimeZone. Clients are responsible for deleting the time zone object returned. ICU 2.0

Definition at line 559 of file timezone.cpp.

References TimeZone::clone(), TimeZone::initDefault(), and NULL.

Referenced by Calendar::Calendar(), Calendar::createInstance(), DateFormat::getTimeZone(), SimpleDateFormat::initializeCalendar(), RelativeDateFormat::initializeCalendar(), Calendar::orphanTimeZone(), DateFormatRegressionTest::Test4065240(), CalendarRegressionTest::test4083167(), CalendarRegressionTest::test4086724(), DateFormatRegressionTest::Test4089106(), DateFormatRegressionTest::Test4103341(), DateFormatRegressionTest::Test4106807(), TimeZoneRegressionTest::Test4154650(), CalendarRegressionTest::Test4162587(), DateFormatTest::TestBadInput135a(), TimeZoneBoundaryTest::TestBoundaries(), DateFormatTest::TestDateFormatZone146(), TimeZoneTest::TestGenericAPI(), DateFormatTest::TestTwoDigitYearDSTParse(), ucal_getDefaultTimeZone(), ucal_open(), and ucal_setTimeZone().

{
    /* This is here to prevent race conditions. */
    UBool needsInit;
    UMTX_CHECK(&LOCK, (DEFAULT_ZONE == NULL), needsInit);
    if (needsInit) {
        initDefault();
    }

    Mutex lock(&LOCK); // In case adoptDefault is called
    return (DEFAULT_ZONE != NULL) ? DEFAULT_ZONE->clone() : NULL;
}


Generated by  Doxygen 1.6.0   Back to index