Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. package RevampClient.utils;
  2.  
  3. public class TimeHelper {
  4.  
  5. private static long LastMS = 0L;
  6.  
  7. public boolean isDelayComplete(float f) {
  8. if(System.currentTimeMillis() - this.LastMS >= f) {
  9. return true;
  10. }
  11. return false;
  12. }
  13.  
  14. public static long getCurrentMS() {
  15. return System.nanoTime() / 10000000L;
  16. }
  17.  
  18. public void setLastMS(long lastMS) {
  19. this.LastMS = System.currentTimeMillis();
  20. }
  21.  
  22. public int convertToMS(int perSecond) {
  23. return 1000 / perSecond;
  24. }
  25.  
  26. public static boolean hasReached(long milliseconds) {
  27. return getCurrentMS() - LastMS >= milliseconds;
  28. }
  29.  
  30. public static void reset() {
  31. LastMS = getCurrentMS();
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement