diff options
author | Bjorn Bringert <bringert@android.com> | 2010-11-23 14:43:12 +0000 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-12-20 15:23:02 -0800 |
commit | f5f75104868ce699db458ce6360f3843371e594f (patch) | |
tree | 024a4ee8436c5f667070e2af6bc2447a46414f00 /core/java | |
parent | 2bd83c00a0c72d3f6bd929c4df5fe83ee31b4704 (diff) | |
download | frameworks_base-f5f75104868ce699db458ce6360f3843371e594f.zip frameworks_base-f5f75104868ce699db458ce6360f3843371e594f.tar.gz frameworks_base-f5f75104868ce699db458ce6360f3843371e594f.tar.bz2 |
Fix issue #3224616: TimeUtils.formatDuration() can drop 0s.
Integrated from master.
Change-Id: Ie12dd25cce03c06fafb7df1335266322df43b038
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/util/TimeUtils.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/java/android/util/TimeUtils.java b/core/java/android/util/TimeUtils.java index 60ca384..85ce5e1 100644 --- a/core/java/android/util/TimeUtils.java +++ b/core/java/android/util/TimeUtils.java @@ -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'); |