Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package xfade_gnomebot;
- //CODE BY XFADE48X
- //OSBOT.ORG
- public class Timer
- {
- private long period;
- private long start;
- public Timer(long period)
- {
- this.period = period;
- start = System.currentTimeMillis();
- }
- public long getElapsed()
- {
- return System.currentTimeMillis() - start;
- }
- public long getRemaining()
- {
- return period - getElapsed();
- }
- public boolean isRunning()
- {
- return getElapsed() <= period;
- }
- public void reset()
- {
- start = System.currentTimeMillis();
- }
- public void stop()
- {
- period = 0;
- }
- public static String format(long milliSeconds)
- {
- long secs = milliSeconds / 1000L;
- return String.format("%02d:%02d:%02d", new Object[] {
- Long.valueOf(secs / 3600L), Long.valueOf((secs % 3600L) / 60L), Long.valueOf(secs % 60L)
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment