Class TimeUtil

java.lang.Object
games.stendhal.server.util.TimeUtil

public class TimeUtil extends Object
Utility functions for time in the game.
  • Field Details

  • Constructor Details

    • TimeUtil

      public TimeUtil()
  • Method Details

    • approxTimeUntil

      public static String approxTimeUntil(int seconds)
      Create a text representing a saying of approximate time until.
      Parameters:
      seconds - The number of seconds till/past (in positive values).
      Returns:
      A text representation.
    • approxTimeUntil

      public static void approxTimeUntil(StringBuilder sbuf, int seconds)
      Append a text representing a saying of approximate time until.
      Parameters:
      sbuf - The buffer to append to.
      seconds - The number of seconds till/past (in positive values).
    • approxUnit

      protected static boolean approxUnit(StringBuilder sbuf, int amount, int size, String name)
      For a given amount and unit size, generate the approximate value.
      Parameters:
      sbuf - The buffer to append to.
      amount - The total amount.
      size - The unit size.
      name - The unit name.
      Returns:
      true if unit used, false if the amount was too small to apply.
    • timeUntil

      public static String timeUntil(int seconds)
      Create a text representing a saying of time until.
      Parameters:
      seconds - The number of seconds till/past (in positive values).
      Returns:
      A text representation.
    • timeUntil

      public static String timeUntil(int seconds, boolean forceSeconds)
      Create a text representing a saying of time until.
      Parameters:
      seconds - The number of seconds till/past (in positive values).
      forceSeconds - Show seconds even if over a minute.
      Returns:
      A text representation.
    • timeUntil

      public static void timeUntil(StringBuilder sbuf, int seconds)
      Append a text representing a saying of time until.
      Parameters:
      sbuf - The buffer to append to.
      seconds - The number of seconds till/past (in positive values).
    • timeUntil

      public static void timeUntil(StringBuilder sbuf, int seconds, boolean forceSeconds)
      Append a text representing a saying of time until.
      Parameters:
      sbuf - The buffer to append to.
      seconds - The number of seconds till/past (in positive values).
      forceSeconds - Show seconds even if over a minute.