mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-3009 calendar code bug fixes - make factory-fresh calendars have the current time, and make calendar subclasses initialize properly
X-SVN-Rev: 12407
This commit is contained in:
parent
477dbae103
commit
51ea41bfc5
3 changed files with 6 additions and 0 deletions
|
@ -33,6 +33,7 @@ static const int32_t kGregorianEpoch = 1970;
|
|||
BuddhistCalendar::BuddhistCalendar(const Locale& aLocale, UErrorCode& success)
|
||||
: GregorianCalendar(aLocale, success)
|
||||
{
|
||||
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
|
||||
}
|
||||
|
||||
BuddhistCalendar::~BuddhistCalendar()
|
||||
|
|
|
@ -544,7 +544,11 @@ Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& succ
|
|||
// a calendar was returned - we assume the factory did the right thing.
|
||||
c = (Calendar*)u;
|
||||
}
|
||||
|
||||
// Now, reset calendar to default state:
|
||||
c->clear();
|
||||
c->adoptTimeZone(zone); // Set the correct time zone
|
||||
c->setTimeInMillis(getNow(), success); // let the new calendar have the current time.
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
@ -281,6 +281,7 @@ const uint32_t JapaneseCalendar::kCurrentEra = (kEraCount-1);
|
|||
JapaneseCalendar::JapaneseCalendar(const Locale& aLocale, UErrorCode& success)
|
||||
: GregorianCalendar(aLocale, success)
|
||||
{
|
||||
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
|
||||
}
|
||||
|
||||
JapaneseCalendar::~JapaneseCalendar()
|
||||
|
|
Loading…
Add table
Reference in a new issue