APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.utils

public final Class TimeUtils

extends Object
Class Inheritance

Wrapper around System.nanoTime() and System.currentTimeMillis(). Use this if you want to be compatible across all platforms!
Author
mzechner

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static long
millis()

Returns: the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

public static long

Returns:

time value in nanoseconds
millisToNanos
(long
must be milliseconds
millis
)

Convert milliseconds time to nanoseconds

public static long

Returns:

time value in milliseconds
nanosToMillis
(long
must be nanoseconds
nanos
)

Convert nanoseconds time to milliseconds

public static long
nanoTime()

Returns: The current value of the system timer, in nanoseconds.

public static long

Returns:

- time passed since prevTime in milliseconds
timeSinceMillis
(long
- must be milliseconds
prevTime
)

Get the time in millis passed since a previous time

public static long

Returns:

- time passed since prevTime in nanoseconds
timeSinceNanos
(long
- must be nanoseconds
prevTime
)

Get the time in nanos passed since a previous time

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nanosPerMilliback to summary
private static final long nanosPerMilli

Constructor Detail

TimeUtilsback to summary
public TimeUtils()

Method Detail

millisback to summary
public static long millis()
Returns:long

the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

millisToNanosback to summary
public static long millisToNanos(long millis)

Convert milliseconds time to nanoseconds

Parameters
millis:long

must be milliseconds

Returns:long

time value in nanoseconds

nanosToMillisback to summary
public static long nanosToMillis(long nanos)

Convert nanoseconds time to milliseconds

Parameters
nanos:long

must be nanoseconds

Returns:long

time value in milliseconds

nanoTimeback to summary
public static long nanoTime()
Returns:long

The current value of the system timer, in nanoseconds.

timeSinceMillisback to summary
public static long timeSinceMillis(long prevTime)

Get the time in millis passed since a previous time

Parameters
prevTime:long

- must be milliseconds

Returns:long

- time passed since prevTime in milliseconds

timeSinceNanosback to summary
public static long timeSinceNanos(long prevTime)

Get the time in nanos passed since a previous time

Parameters
prevTime:long

- must be nanoseconds

Returns:long

- time passed since prevTime in nanoseconds