Salty as fuck Posted March 6, 2016 Posted March 6, 2016 (edited) you should definitely get a runtime set up in there public void onStart() { startTime = System.currentTimeMillis(); } public String format(long time) { StringBuilder string = new StringBuilder(); long totalSeconds = time / 1000L; long totalMinutes = totalSeconds / 60L; long totalHours = totalMinutes / 60L; int seconds = (int)totalSeconds % 60; int minutes = (int)totalMinutes % 60; int hours = (int)totalHours % 24; if (hours > 0) { string.append(hours + "h "); } if (minutes > 0) { string.append(minutes + "m "); } string.append(seconds +"s"); return string.toString(); } g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)), 555, 418); Edited March 6, 2016 by Reminiscence
The Hero of Time Posted March 6, 2016 Author Posted March 6, 2016 you should definitely get a runtime set up in there public void onStart() { startTime = System.currentTimeMillis(); } public String format(long time) { StringBuilder string = new StringBuilder(); long totalSeconds = time / 1000L; long totalMinutes = totalSeconds / 60L; long totalHours = totalMinutes / 60L; int seconds = (int)totalSeconds % 60; int minutes = (int)totalMinutes % 60; int hours = (int)totalHours % 24; if (hours > 0) { string.append(hours + "h "); } if (minutes > 0) { string.append(minutes + "m "); } string.append(seconds +"s"); return string.toString(); } g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)), 555, 418); true lmao, thanks :P
lisabe96 Posted March 6, 2016 Posted March 6, 2016 (edited) you should definitely get a runtime set up in there public void onStart() { startTime = System.currentTimeMillis(); } public String format(long time) { StringBuilder string = new StringBuilder(); long totalSeconds = time / 1000L; long totalMinutes = totalSeconds / 60L; long totalHours = totalMinutes / 60L; int seconds = (int)totalSeconds % 60; int minutes = (int)totalMinutes % 60; int hours = (int)totalHours % 24; if (hours > 0) { string.append(hours + "h "); } if (minutes > 0) { string.append(minutes + "m "); } string.append(seconds +"s"); return string.toString(); } g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)), 555, 418); Or since it's skill training: formatTime(expTracker.getElapsed(Skill.WOODCUTTING)) And to format the time: public static String formatTime(long ms) { long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } Edited March 6, 2016 by lisabe96 1