Package games.stendhal.server.util
Class TimeUtil
java.lang.Object
games.stendhal.server.util.TimeUtil
Utility functions for time in the game.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final longstatic final longstatic final longstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringapproxTimeUntil(int seconds) Create a text representing a saying of approximate time until.static voidapproxTimeUntil(StringBuilder sbuf, int seconds) Append a text representing a saying of approximate time until.protected static booleanapproxUnit(StringBuilder sbuf, int amount, int size, String name) For a given amount and unit size, generate the approximate value.static StringtimeUntil(int seconds) Create a text representing a saying of time until.static StringtimeUntil(int seconds, boolean forceSeconds) Create a text representing a saying of time until.static voidtimeUntil(StringBuilder sbuf, int seconds) Append a text representing a saying of time until.static voidtimeUntil(StringBuilder sbuf, int seconds, boolean forceSeconds) Append a text representing a saying of time until.
-
Field Details
-
MILLISECONDS_IN_MINUTE
public static final long MILLISECONDS_IN_MINUTE- See Also:
-
MILLISECONDS_IN_HOUR
public static final long MILLISECONDS_IN_HOUR- See Also:
-
MILLISECONDS_IN_DAY
public static final long MILLISECONDS_IN_DAY- See Also:
-
MILLISECONDS_IN_WEEK
public static final long MILLISECONDS_IN_WEEK- See Also:
-
SECONDS_IN_MINUTE
public static final int SECONDS_IN_MINUTE- See Also:
-
SECONDS_IN_HOUR
public static final int SECONDS_IN_HOUR- See Also:
-
SECONDS_IN_DAY
public static final int SECONDS_IN_DAY- See Also:
-
SECONDS_IN_WEEK
public static final int SECONDS_IN_WEEK- See Also:
-
MINUTES_IN_HOUR
public static final int MINUTES_IN_HOUR- See Also:
-
MINUTES_IN_DAY
public static final int MINUTES_IN_DAY- See Also:
-
MINUTES_IN_WEEK
public static final int MINUTES_IN_WEEK- See Also:
-
MINUTES_IN_YEAR
public static final int MINUTES_IN_YEAR- See Also:
-
MINUTES_IN_HALF_YEAR
public static final int MINUTES_IN_HALF_YEAR- See Also:
-
TURNS_IN_MINUTE
public static final int TURNS_IN_MINUTE- See Also:
-
-
Constructor Details
-
TimeUtil
public TimeUtil()
-
-
Method Details
-
approxTimeUntil
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
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
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:
trueif unit used,falseif the amount was too small to apply.
-
timeUntil
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
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
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
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.
-