Class TimeUtilities
java.lang.Object
de.gurkenlabs.litiengine.util.TimeUtilities
Utility class for various time-related operations. This class cannot be instantiated.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum representing various timer formats. -
Method Summary
Modifier and TypeMethodDescriptionstatic longgetDays(long ms) Converts milliseconds to days.static longgetHours(long ms) Converts milliseconds to hours.static longgetMinutes(long ms) Converts milliseconds to minutes.static longgetRemainingDays(long ms) Gets the remaining days from the given milliseconds.static longgetRemainingHours(long ms) Gets the remaining hours from the given milliseconds.static longgetRemainingMilliSeconds(long ms) Gets the remaining milliseconds from the given milliseconds.static longgetRemainingMinutes(long ms) Gets the remaining minutes from the given milliseconds.static longgetRemainingSeconds(long ms) Gets the remaining seconds from the given milliseconds.static longgetSeconds(long ms) Converts milliseconds to seconds.static doublenanoToMs(long nano) Converts nanoseconds to milliseconds.static StringtoTimerFormat(long duration, TimeUtilities.TimerFormat format) Converts a duration to a formatted timer string based on the specified timer format.
-
Method Details
-
nanoToMs
public static double nanoToMs(long nano) Converts nanoseconds to milliseconds.- Parameters:
nano- the duration in nanoseconds- Returns:
- the duration in milliseconds
-
getDays
public static long getDays(long ms) Converts milliseconds to days.- Parameters:
ms- the duration in milliseconds- Returns:
- the duration in days
-
getHours
public static long getHours(long ms) Converts milliseconds to hours.- Parameters:
ms- the duration in milliseconds- Returns:
- the duration in hours
-
getMinutes
public static long getMinutes(long ms) Converts milliseconds to minutes.- Parameters:
ms- the duration in milliseconds- Returns:
- the duration in minutes
-
getSeconds
public static long getSeconds(long ms) Converts milliseconds to seconds.- Parameters:
ms- the duration in milliseconds- Returns:
- the duration in seconds
-
getRemainingDays
public static long getRemainingDays(long ms) Gets the remaining days from the given milliseconds.- Parameters:
ms- the duration in milliseconds- Returns:
- the remaining days
-
getRemainingHours
public static long getRemainingHours(long ms) Gets the remaining hours from the given milliseconds.- Parameters:
ms- the duration in milliseconds- Returns:
- the remaining hours
-
getRemainingMinutes
public static long getRemainingMinutes(long ms) Gets the remaining minutes from the given milliseconds.- Parameters:
ms- the duration in milliseconds- Returns:
- the remaining minutes
-
getRemainingSeconds
public static long getRemainingSeconds(long ms) Gets the remaining seconds from the given milliseconds.- Parameters:
ms- the duration in milliseconds- Returns:
- the remaining seconds
-
getRemainingMilliSeconds
public static long getRemainingMilliSeconds(long ms) Gets the remaining milliseconds from the given milliseconds.- Parameters:
ms- the duration in milliseconds- Returns:
- the remaining milliseconds
-
toTimerFormat
Converts a duration to a formatted timer string based on the specified timer format.- Parameters:
duration- the duration in millisecondsformat- the timer format to use- Returns:
- the formatted timer string
-