Class TimeUtil

java.lang.Object
com.hypixel.hytale.common.util.TimeUtil

public class TimeUtil extends Object
  • Constructor Details

    • TimeUtil

      public TimeUtil()
  • Method Details

    • compareDifference

      public static int compareDifference(@Nonnull Instant from, @Nonnull Instant to, @Nonnull Duration duration)
      Allocation free version of the following:
      Duration.between(from, to).compareTo(duration)
      
      May allocate an exception if the time difference between the two instants don't fit into a single long (about 292 years).
      Returns:
      a value larger than 0 if the difference between from and to is larger than duration, a value less than 0 if the difference is smaller and 0 if they are equal.