-void
-IndianCalendar::initializeSystemDefaultCentury()
-{
- // initialize systemDefaultCentury and systemDefaultCenturyYear based
- // on the current time. They'll be set to 80 years before
- // the current time.
- // No point in locking as it should be idempotent.
- if (fgSystemDefaultCenturyStart == fgSystemDefaultCentury) {
- UErrorCode status = U_ZERO_ERROR;
-
- IndianCalendar calendar(Locale("@calendar=Indian"),status);
- if (U_SUCCESS(status)) {
- calendar.setTime(Calendar::getNow(), status);
- calendar.add(UCAL_YEAR, -80, status);
-
- UDate newStart = calendar.getTime(status);
- int32_t newYear = calendar.get(UCAL_YEAR, status);
-
- {
- Mutex m;
-
- fgSystemDefaultCenturyStart = newStart;
- fgSystemDefaultCenturyStartYear = newYear;
- }
- }
-
- // We have no recourse upon failure unless we want to propagate the failure
- // out.
- }
-}