Package games.stendhal.server.util
Class TimeUtil
java.lang.Object
games.stendhal.server.util.TimeUtil
Utility functions for time in the game.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static int
protected static int
protected static int
protected static int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
approxTimeUntil(int seconds)
Create a text representing a saying of approximate time until.static void
approxTimeUntil(StringBuilder sbuf, int seconds)
Append a text representing a saying of approximate time until.protected static boolean
approxUnit(StringBuilder sbuf, int amount, int size, String name)
For a given amount and unit size, generate the approximate value.static String
timeUntil(int seconds)
Create a text representing a saying of time until.static String
timeUntil(int seconds, boolean forceSeconds)
Create a text representing a saying of time until.static void
timeUntil(StringBuilder sbuf, int seconds)
Append a text representing a saying of time until.static void
timeUntil(StringBuilder sbuf, int seconds, boolean forceSeconds)
Append a text representing a saying of time until.
-
Field Details
-
SECONDS_IN_WEEK
protected static final int SECONDS_IN_WEEK- See Also:
- Constant Field Values
-
SECONDS_IN_DAY
protected static final int SECONDS_IN_DAY- See Also:
- Constant Field Values
-
SECONDS_IN_HOUR
protected static final int SECONDS_IN_HOUR- See Also:
- Constant Field Values
-
SECONDS_IN_MINUTE
protected static final int SECONDS_IN_MINUTE- See Also:
- Constant Field Values
-
-
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:
true
if unit used,false
if 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.
-