Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hh:mm:ss Run Time Method?

Featured Replies

I think we're all here to learn. I can count all the true java wizards I know in the botting community on one hand. 

This is the same thing as above but even worse.

 

I really don't see why people insist on making their code unreadable just because "it saves lines". I know the ternary is actually slower in C# when compared to nested if statements because of the JIT trying to make optimizations, not sure about Java.

 

Apaec is faster on average by 90ms on my computer.

 

Apaec          vs.           Czar

69.194                     159.609

 

Baseline code:

package dateBaseLiner;

public class IWannaBeLikeKanye {

	public static void main(String[] args) {
		for (int f = 0; f < 1000; f++) {
		long startTime = System.currentTimeMillis();
		for (int a = 0; a < 1000; a++) {
			for (int y = 0; y < 1000; y++) {
				format(startTime);
			}
		}
		long endTime = System.currentTimeMillis();
		System.out.println((endTime - startTime));
		}
	}

	public static String format(final long time) {
		final int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60;
		return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
	}

	public static String tformat(long time) {
		StringBuilder t = new StringBuilder();
		long total_secs = time / 1000L;
		long total_mins = total_secs / 60L;
		long total_hrs = total_mins / 60L;
		int secs = (int) total_secs % 60;
		int mins = (int) total_mins % 60;
		int hrs = (int) total_hrs % 24;
		if (hrs < 10) {
			t.append("0");
		}
		t.append(hrs).append(":");
		if (mins < 10) {
			t.append("0");
		}
		t.append(mins).append(":");
		if (secs < 10) {
			t.append("0");
		}
		t.append(secs);
		return t.toString();
	}

}

Edited by Fay

That awkward moment when SimpleDateFormat isn't simple enough for anyone to understand....

   public String getSuperComplexFormatTime (long time) {
        return new SimpleDateFormat("H:mm:ss").format(new Date(time - TimeZone.getDefault().getRawOffset()));
    }
Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.