Enum Class MindustryTimeUnit
- All Implemented Interfaces:
Serializable,Comparable<MindustryTimeUnit>,Constable
Time units used by the
PluginTask.Builder and PluginTask classes to represent time.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionTime unit representing twenty-four hours.Time unit representing sixty minutes.Time unit representing one thousandth of a second.Time unit representing sixty seconds.Time unit representing one thousandth of a millisecond.Time unit representing one game loop, which is 60 times per second. -
Method Summary
Modifier and TypeMethodDescriptionlongconvert(long sourceDuration, MindustryTimeUnit sourceUnit) Converts the given duration in the given time unit to this time unit.Returns the Java time unit associated with this Mindustry time unit, if any.static MindustryTimeUnitReturns the enum constant of this class with the specified name.static MindustryTimeUnit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MILLISECONDS
Time unit representing one thousandth of a second. -
TICKS
Time unit representing one game loop, which is 60 times per second. -
SECONDS
Time unit representing one thousandth of a millisecond. -
MINUTES
Time unit representing sixty seconds. -
HOURS
Time unit representing sixty minutes. -
DAYS
Time unit representing twenty-four hours.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
convert
Converts the given duration in the given time unit to this time unit.Since this method is equivalent to
TimeUnit.convert(long, TimeUnit):- If it overflows, the result will be
Long.MAX_VALUEif the duration is positive, orLong.MIN_VALUEif it is negative. - Conversions are floored so converting 999 milliseconds to seconds results in 0.
- Parameters:
sourceDuration- the duration to convertsourceUnit- the time unit of the duration- Returns:
- the converted duration
- See Also:
- If it overflows, the result will be
-
getJavaTimeUnit
Returns the Java time unit associated with this Mindustry time unit, if any.
-