diff options
Diffstat (limited to 'src/com/android/deskclock/stopwatch/Stopwatches.java')
-rw-r--r-- | src/com/android/deskclock/stopwatch/Stopwatches.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/com/android/deskclock/stopwatch/Stopwatches.java b/src/com/android/deskclock/stopwatch/Stopwatches.java index d8d0741d5..94af594b4 100644 --- a/src/com/android/deskclock/stopwatch/Stopwatches.java +++ b/src/com/android/deskclock/stopwatch/Stopwatches.java @@ -19,7 +19,6 @@ package com.android.deskclock.stopwatch; import android.content.Context; import com.android.deskclock.R; -import com.android.deskclock.stopwatch.StopwatchFragment.Lap; public class Stopwatches { // Private actions processed by the receiver @@ -107,4 +106,23 @@ public class Stopwatches { return timeStr; } + /*** + * Sets the string of the time running on the stopwatch up to hundred of a second accuracy + * @param time - in hundreds of a second since the stopwatch started + */ + public static String formatTimeText(long time, final String format) { + if (time < 0) { + time = 0; + } + long hundreds, seconds, minutes, hours; + seconds = time / 1000; + hundreds = (time - seconds * 1000) / 10; + minutes = seconds / 60; + seconds = seconds - minutes * 60; + hours = minutes / 60; + minutes = minutes - hours * 60; + String timeStr = String.format(format, hours, minutes, seconds, hundreds); + return timeStr; + } + } |