Class TimeUtil

java.lang.Object
ca.spottedleaf.concurrentutil.util.TimeUtil

public final class TimeUtil extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    clampTime(long value, long min, long max)
     
    static int
    compareTimes(long t1, long t2)
    This function is appropriate to be used as a Comparator between two timestamps, which indicates whether the timestamps represented by t1, t2 that t1 is before, equal to, or after t2.
    static long
    getGreatestTime(long t1, long t2)
     
    static long
    getLeastTime(long t1, long t2)
     
    static boolean
    isAfter(long t1, long t2)
    Tests whether t1 is after t2.
    static boolean
    isAfterOrSame(long t1, long t2)
    Tests whether t1 is the same as or after t2.
    static boolean
    isBefore(long t1, long t2)
    Tests whether t1 is before t2.
    static boolean
    isBeforeOrSame(long t1, long t2)
    Tests whether t1 is the same as or before t2.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • compareTimes

      public static int compareTimes(long t1, long t2)
      This function is appropriate to be used as a Comparator between two timestamps, which indicates whether the timestamps represented by t1, t2 that t1 is before, equal to, or after t2.
    • isBefore

      public static boolean isBefore(long t1, long t2)
      Tests whether t1 is before t2.
    • isBeforeOrSame

      public static boolean isBeforeOrSame(long t1, long t2)
      Tests whether t1 is the same as or before t2.
    • isAfter

      public static boolean isAfter(long t1, long t2)
      Tests whether t1 is after t2.
    • isAfterOrSame

      public static boolean isAfterOrSame(long t1, long t2)
      Tests whether t1 is the same as or after t2.
    • getGreatestTime

      public static long getGreatestTime(long t1, long t2)
    • getLeastTime

      public static long getLeastTime(long t1, long t2)
    • clampTime

      public static long clampTime(long value, long min, long max)