1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Merge pull request #2179 from Redirion/patch-2

Improve performance of getTimeString
This commit is contained in:
Tobias Groza 2019-03-04 19:16:43 +01:00 committed by GitHub
commit aec3f19d23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()