Package arc.util

Class Time

java.lang.Object
arc.util.Time

public class Time extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static float
    Global delta value.
    static float
    Global time values.
    static final long
     
    static float
    Global time values.
    static final float
    Conversion factors for ticks to other unit values.
    static final float
    Conversion factors for ticks to other unit values.
    static final float
    Conversion factors for ticks to other unit values.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static float
    A value of -1 means mark() wasn't called beforehand.
    static void
     
    static long
     
    static long
    millisToNanos(long millis)
    Convert milliseconds time to nanoseconds
    static long
     
    static long
    nanosToMillis(long nanos)
    Convert nanoseconds time to milliseconds
    static void
    run(float delay, Runnable r)
    Runs a task with a delay of several ticks.
    static Timer.Task
    runTask(float delay, Runnable r)
    Runs a task with a delay of several ticks.
    static void
     
    static long
    timeSinceMillis(long prevTime)
    Get the time in millis passed since a previous time
    static long
    timeSinceNanos(long prevTime)
    Get the time in nanos passed since a previous time
    static void
    Use normal delta time (e.
    static void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • toSeconds

      public static final float toSeconds
      Conversion factors for ticks to other unit values.
      See Also:
    • toMinutes

      public static final float toMinutes
      Conversion factors for ticks to other unit values.
      See Also:
    • toHours

      public static final float toHours
      Conversion factors for ticks to other unit values.
      See Also:
    • delta

      public static float delta
      Global delta value. Do not change.
    • time

      public static float time
      Global time values. Do not change.
    • globalTime

      public static float globalTime
      Global time values. Do not change.
    • nanosPerMilli

      public static final long nanosPerMilli
      See Also:
  • Constructor Details

    • Time

      public Time()
  • Method Details

    • run

      public static void run(float delay, Runnable r)
      Runs a task with a delay of several ticks. If Time.clear() is called, this task will be cancelled.
    • runTask

      public static Timer.Task runTask(float delay, Runnable r)
      Runs a task with a delay of several ticks. Unless the application is closed, this task will always complete.
    • mark

      public static void mark()
    • elapsed

      public static float elapsed()
      A value of -1 means mark() wasn't called beforehand.
    • updateGlobal

      public static void updateGlobal()
    • update

      public static void update()
      Use normal delta time (e. g. delta * 60)
    • clear

      public static void clear()
    • setDeltaProvider

      public static void setDeltaProvider(Floatp impl)
    • nanos

      public static long nanos()
      Returns:
      The current value of the system timer, in nanoseconds.
    • millis

      public static long millis()
      Returns:
      the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
    • nanosToMillis

      public static long nanosToMillis(long nanos)
      Convert nanoseconds time to milliseconds
      Parameters:
      nanos - must be nanoseconds
      Returns:
      time value in milliseconds
    • millisToNanos

      public static long millisToNanos(long millis)
      Convert milliseconds time to nanoseconds
      Parameters:
      millis - must be milliseconds
      Returns:
      time value in nanoseconds
    • timeSinceNanos

      public static long timeSinceNanos(long prevTime)
      Get the time in nanos passed since a previous time
      Parameters:
      prevTime - - must be nanoseconds
      Returns:
      - time passed since prevTime in nanoseconds
    • timeSinceMillis

      public static long timeSinceMillis(long prevTime)
      Get the time in millis passed since a previous time
      Parameters:
      prevTime - - must be milliseconds
      Returns:
      - time passed since prevTime in milliseconds