562 |
// rest of code assumes day/month/year set |
// rest of code assumes day/month/year set |
563 |
// should negative BC years be AD? |
// should negative BC years be AD? |
564 |
// get the hour (but no check for validity) |
// get the hour (but no check for validity) |
565 |
if (isSet[HOUR_OF_DAY]) |
if (isSet[HOUR]) |
|
hour = fields[HOUR_OF_DAY]; |
|
|
else if (isSet[HOUR]) |
|
566 |
{ |
{ |
567 |
hour = fields[HOUR]; |
hour = fields[HOUR]; |
568 |
if (isSet[AM_PM] && fields[AM_PM] == PM) |
if (fields[AM_PM] == PM) |
569 |
if (hour != 12) /* not Noon */ |
if (hour != 12) /* not Noon */ |
570 |
hour += 12; |
hour += 12; |
571 |
/* Fix the problem of the status of 12:00 AM (midnight). */ |
/* Fix the problem of the status of 12:00 AM (midnight). */ |
572 |
if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) |
if (fields[AM_PM] == AM && hour == 12) |
573 |
hour = 0; |
hour = 0; |
574 |
} |
} |
575 |
|
else |
576 |
|
hour = fields[HOUR_OF_DAY]; |
577 |
|
|
578 |
// Read the era,year,month,day fields and convert as appropriate. |
// Read the era,year,month,day fields and convert as appropriate. |
579 |
// Calculate number of milliseconds into the day |
// Calculate number of milliseconds into the day |
644 |
weekday += 7; |
weekday += 7; |
645 |
fields[DAY_OF_WEEK] = weekday; |
fields[DAY_OF_WEEK] = weekday; |
646 |
|
|
647 |
|
// Time zone corrections. |
648 |
TimeZone zone = getTimeZone(); |
TimeZone zone = getTimeZone(); |
649 |
int rawOffset = zone.getRawOffset(); |
int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] |
650 |
int dstOffset = zone.getOffset((year < 1) ? BC : AD, |
: zone.getRawOffset(); |
651 |
(year < 1) ? 1 - year : year, month, day, |
|
652 |
weekday, millisInDay) - zone.getRawOffset(); |
int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] |
653 |
time -= (rawOffset + dstOffset); |
: (zone.getOffset((year < 0) ? BC : AD, |
654 |
|
(year < 0) ? 1 - year |
655 |
|
: year, |
656 |
|
month, day, weekday, |
657 |
|
millisInDay) |
658 |
|
- zone.getRawOffset()); |
659 |
|
|
660 |
|
time -= rawOffset + dstOffset; |
661 |
|
|
662 |
isTimeSet = true; |
isTimeSet = true; |
663 |
} |
} |
1109 |
private static final int[] minimums = |
private static final int[] minimums = |
1110 |
{ |
{ |
1111 |
BC, 1, 0, 0, 1, 1, 1, SUNDAY, 1, AM, |
BC, 1, 0, 0, 1, 1, 1, SUNDAY, 1, AM, |
1112 |
1, 0, 1, 1, 1, -(12 * 60 * 60 * 1000), |
1, 0, 0, 0, 0, -(12 * 60 * 60 * 1000), |
1113 |
0 |
0 |
1114 |
}; |
}; |
1115 |
|
|