ICU-13717 Refactoring UDAT_FRACTIONAL_SECOND_FIELD to use zeroPaddingNumber for consistency with all other number formatting call sites in smpdtfmt.cpp

X-SVN-Rev: 41433
This commit is contained in:
Shane Carr 2018-05-22 22:21:59 +00:00
parent c2412adb1e
commit 7d627ba160

View file

@ -1566,18 +1566,15 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
case UDAT_FRACTIONAL_SECOND_FIELD:
// Fractional seconds left-justify
{
currentNumberFormat->setMinimumIntegerDigits((count > 3) ? 3 : count);
currentNumberFormat->setMaximumIntegerDigits(maxIntCount);
int32_t minDigits = (count > 3) ? 3 : count;
if (count == 1) {
value /= 100;
} else if (count == 2) {
value /= 10;
}
FieldPosition p(FieldPosition::DONT_CARE);
currentNumberFormat->format(value, appendTo, p);
zeroPaddingNumber(currentNumberFormat, appendTo, value, minDigits, maxIntCount);
if (count > 3) {
currentNumberFormat->setMinimumIntegerDigits(count - 3);
currentNumberFormat->format((int32_t)0, appendTo, p);
zeroPaddingNumber(currentNumberFormat, appendTo, 0, count - 3, maxIntCount);
}
}
break;