int rawOffset = zone.getRawOffset(); int dstOffset = zone.getOffset((year < 1) ? BC : AD, (year < 1) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset(); time -= (rawOffset + dstOffset);
int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset();  int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset());  time -= rawOffset + dstOffset;
  protected synchronized void computeTime()  {    int millisInDay = 0;    int era = fields[ERA];    int year = fields[YEAR];	int month = fields[MONTH];    int day = fields[DAY_OF_MONTH];    int minute = fields[MINUTE];    int second = fields[SECOND];    int millis = fields[MILLISECOND];    int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };    int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };    int hour = 0;    if (! isLenient())      nonLeniencyCheck();    if (! isSet[MONTH])	  {	// 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR	if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR])	  {	    int first = getFirstDayOfMonth(year, 0);	    int offs;	    if ((8 - first) >= getMinimalDaysInFirstWeek())	      // start counting on first week	      offs = 1;	    else	      offs = 1 + (8 - first);	    month = 0;	    day = offs + 7 * (fields[WEEK_OF_YEAR] - 1);	    day += fields[DAY_OF_WEEK] - first;	  }	else	  {	    // 4:  YEAR + DAY_OF_YEAR	    month = 0;	    day = fields[DAY_OF_YEAR];	  }      }    else      {	if (isSet[DAY_OF_WEEK])	  {	    int first = getFirstDayOfMonth(year, month);	    // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK	    if (isSet[DAY_OF_WEEK_IN_MONTH])	      {		int offs = fields[DAY_OF_WEEK] - first;		if (offs < 0)		  offs += 7;		day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1);		day += offs;	      }	    else	      { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK		day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1);		day += fields[DAY_OF_WEEK] - first;	      }	  }	// 1:  YEAR + MONTH + DAY_OF_MONTH      }    if (era == BC && year > 0)      year = 1 - year;    // rest of code assumes day/month/year set    // should negative BC years be AD?    // get the hour (but no check for validity)		if (isSet[HOUR_OF_DAY])			hour = fields[HOUR_OF_DAY];    else if (isSet[HOUR])      {			hour = fields[HOUR];			if (isSet[AM_PM] && fields[AM_PM] == PM)	  if (hour != 12) /* not Noon */				hour += 12;	/* Fix the problem of the status of 12:00 AM (midnight). */	if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12)	  hour = 0;		}    // Read the era,year,month,day fields and convert as appropriate.    // Calculate number of milliseconds into the day    // This takes care of both h, m, s, ms over/underflows.    long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis;    day += allMillis / (24 * 60 * 60 * 1000L);			millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L));    if (month < 0)      {	year += (int) month / 12;	month = month % 12;	if (month < 0)	  {	    month += 12;	    year--;      }      }    if (month > 11)      {	year += (month / 12);	month = month % 12;      }    month_days[1] = isLeapYear(year) ? 29 : 28;    while (day <= 0)      {	if (month == 0)	  {	    year--;	    month_days[1] = isLeapYear(year) ? 29 : 28;      }	month = (month + 11) % 12;	day += month_days[month];	}    while (day > month_days[month])  {	day -= (month_days[month]);	month = (month + 1) % 12;	if (month == 0)	  {	    year++;	    month_days[1] = isLeapYear(year) ? 29 : 28;	  }      }    // ok, by here we have valid day,month,year,era and millisinday    int dayOfYear = dayCount[month] + day - 1; // (day starts on 1)    if (isLeapYear(year) && month > 1)      dayOfYear++;    int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear                      - EPOCH_DAYS; // gregorian days from 1 to epoch.    int gregFactor = (int) Math.floor((double) (year - 1) / 400.)                     - (int) Math.floor((double) (year - 1) / 100.);    if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover)      relativeDay += gregFactor;    else      relativeDay -= 2;    time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay;    // the epoch was a Thursday.    int weekday = (int) (relativeDay + THURSDAY) % 7;    if (weekday <= 0)      weekday += 7;    fields[DAY_OF_WEEK] = weekday;    TimeZone zone = getTimeZone();    int rawOffset = zone.getRawOffset();    int dstOffset = zone.getOffset((year < 1) ? BC : AD,                                   (year < 1) ? 1 - year : year, month, day,                                   weekday, millisInDay) - zone.getRawOffset();    time -= (rawOffset + dstOffset);    isTimeSet = true;	}