Don't drop zeros in the second position in formatDuration()
Bug: 3223250 Change-Id: I462c96af51cc052f9df1dc3d2c668551b10155ea
This commit is contained in:
@ -158,18 +158,17 @@ public class TimeUtils {
|
||||
static private int printField(char[] formatStr, int amt, char suffix, int pos,
|
||||
boolean always, int zeropad) {
|
||||
if (always || amt > 0) {
|
||||
final int startPos = pos;
|
||||
if ((always && zeropad >= 3) || amt > 99) {
|
||||
int dig = amt/100;
|
||||
formatStr[pos] = (char)(dig + '0');
|
||||
pos++;
|
||||
always = true;
|
||||
amt -= (dig*100);
|
||||
}
|
||||
if ((always && zeropad >= 2) || amt > 9) {
|
||||
if ((always && zeropad >= 2) || amt > 9 || startPos != pos) {
|
||||
int dig = amt/10;
|
||||
formatStr[pos] = (char)(dig + '0');
|
||||
pos++;
|
||||
always = true;
|
||||
amt -= (dig*10);
|
||||
}
|
||||
formatStr[pos] = (char)(amt + '0');
|
||||
|
Reference in New Issue
Block a user