Merge pull request #2179 from Redirion/patch-2
Improve performance of getTimeString
This commit is contained in:
commit
aec3f19d23
|
@ -70,10 +70,10 @@ public class PlayerHelper {
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public static String getTimeString(int milliSeconds) {
|
public static String getTimeString(int milliSeconds) {
|
||||||
long seconds = (milliSeconds % 60000L) / 1000L;
|
int seconds = (milliSeconds % 60000) / 1000;
|
||||||
long minutes = (milliSeconds % 3600000L) / 60000L;
|
int minutes = (milliSeconds % 3600000) / 60000;
|
||||||
long hours = (milliSeconds % 86400000L) / 3600000L;
|
int hours = (milliSeconds % 86400000) / 3600000;
|
||||||
long days = (milliSeconds % (86400000L * 7L)) / 86400000L;
|
int days = (milliSeconds % (86400000 * 7)) / 86400000;
|
||||||
|
|
||||||
stringBuilder.setLength(0);
|
stringBuilder.setLength(0);
|
||||||
return days > 0 ? stringFormatter.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds).toString()
|
return days > 0 ? stringFormatter.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds).toString()
|
||||||
|
|
Loading…
Reference in New Issue