Chinese calendar missing constructor call to setTimeInMillis()

Description

The ICU Chinese calendar seems to be missing a call to setTimeInMillis() in
its constructor. All the other ICU calendars seem to have this, and unless
I explicitly call setTimeInMillis( someInt ) after creating a
ChineseCalendar, rolling||adding||setting fields seems to yield incorrect
timestamps when getting the milliseconds later.

// This version doesn"t seem to work correctly
com.ibm.icu.util.ChineseCalendar chineseCalendar = new
com.ibm.icu.util.ChineseCalendar();
chineseCalendar.set( Calendar.YEAR, 22 );
chineseCalendar.set( Calendar.MONTH, 0 );
chineseCalendar.set( Calendar.DATE, 19 );
chineseCalendar.add( Calendar.DATE, 1 );

// This yields -144684979200000, which turns into Fri Mar 05 00:00:00 PST 2616
milli = chineseCalendar.getTimeInMillis();

System.out.println("chineseCalendar.getTimeInMillis() = " + milli);
System.out.println("chineseCalendar date = " + new Date(milli));

// This version works as expected
com.ibm.icu.util.ChineseCalendar chineseCalendar = new
com.ibm.icu.util.ChineseCalendar();
// Must forcibly set the time in milliseconds to something or the milliseconds
will not evaluate correctly later
chineseCalendar.setTimeInMillis( System.getTimeInMillis() );
chineseCalendar.set( Calendar.YEAR, 22 );
chineseCalendar.set( Calendar.MONTH, 0 );
chineseCalendar.set( Calendar.DATE, 19 );
chineseCalendar.add( Calendar.DATE, 1 );

// This yielded 1109626848245 in testing, which turns into Mon Feb 28 13:40:48
PST 2005,
// which was the expected date result (hours, minutes and seconds can be
ignored for my purposes)
milli = chineseCalendar.getTimeInMillis();

System.out.println("chineseCalendar.getTimeInMillis() = " + milli);
System.out.println("chineseCalendar date = " + new Date(milli));

Activity

Show:
TracBot
June 30, 2018, 11:55 PM
Trac Comment by auditor—1970-01-01T01:19:18.000Z
  • Wed Jun 15 12:17:01 2005 weiv changed notes2: assign: "" to "srl", target: "UNSCH" to "",

  • Wed Jun 15 12:17:01 2005 weiv moved from incoming to formatting

  • Wed Jun 15 13:42:16 2005 grhoten changed notes2: priority: "" to "medium", target: "UNSCH" to "3.4", weeks: "" to "0.05",

  • Tue Sep 27 14:12:18 2005 weiv changed notes2: (via expression '$PglTl3.5') target: "3.4" to "",

  • Thu Dec 15 21:55:39 2005 weiv changed notes2: priority: "medium" to "critical", target: "UNSCH" to "3.6",

  • Fri Dec 16 10:47:42 2005 dougfelt changed notes2: assign: "srl" to "doug", review: "" to "srl", target: "3.6" to "3.4.2",

  • Fri Dec 16 11:20:24 2005 srl changed notes2: xref: "" to "4978",

  • Mon Dec 19 11:02:50 2005 dougfelt changed notes2: xref: "4978" to "",

  • Mon Jan 23 11:12:50 2006 srl moved from formatting to fixed

  • Sun Oct 22 07:29:00 2006 grhoten moved from fixed to closed

Fixed

Assignee

Douglas Felt

Reporter

TracBot

Components

Labels

None

Reviewer

None

Priority

blocks-release

Time Needed

None

Fix versions