API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util.concurrent. TimeUnit View Source
Author(s)
Doug Lea
Since
1.5
Version
Serial
Hierarchy
 Object
      Enum
          TimeUnit
Implements
Subclasses
Description
public enum TimeUnit
  A TimeUnit represents time durations at a given unit of granularity and provides utility methods to convert across units, and to perform timing and delay operations in these units.
See also:   
Enum Constants
NANOSECONDS
MICROSECONDS
MILLISECONDS
SECONDS
MINUTES
HOURS
DAYS
Methods
Hide/Show inherited methods
protectedfinal Object clone () throws CloneNotSupportedException [Inherited From Enum]
  Throws CloneNotSupportedException.
publicfinal int compareTo ( E o) [Inherited From Enum]
  Compares this enum with the specified object for order.
public long convert (long sourceDuration, TimeUnit sourceUnit)
  Convert the given time duration in the given unit to this unit.
publicfinal boolean equals (Object other) [Inherited From Enum]
  Returns true if the specified object is equal to this enum constant.
pack-privateabstract int excessNanos (long d, long m)
  Utility to compute the excess-nanosecond argument to wait, sleep, join.
protectedfinal void finalize () [Inherited From Enum]
enum classes cannot have finalize methods.
publicfinal Class< E> getDeclaringClass () [Inherited From Enum]
  Returns the Class object corresponding to this enum constant's enum type.
publicfinal int hashCode () [Inherited From Enum]
  Returns a hash code for this enum constant.
publicfinal String name () [Inherited From Enum]
  Returns the name of this enum constant, exactly as declared in its enum declaration.
publicfinal int ordinal () [Inherited From Enum]
  Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).
public void sleep (long timeout) throws InterruptedException
  Performs a Thread.sleep using this unit.
public void timedJoin (Thread thread, long timeout) throws InterruptedException
  Performs a timed Thread.join using this time unit.
public void timedWait (Object obj, long timeout) throws InterruptedException
  Performs a timed Object.wait using this time unit.
public long toDays (long duration)
  Equivalent to DAYS.convert(duration, this).
public long toHours (long duration)
  Equivalent to HOURS.convert(duration, this).
public long toMicros (long duration)
  Equivalent to MICROSECONDS.convert(duration, this).
public long toMillis (long duration)
  Equivalent to MILLISECONDS.convert(duration, this).
public long toMinutes (long duration)
  Equivalent to MINUTES.convert(duration, this).
public long toNanos (long duration)
  Equivalent to NANOSECONDS.convert(duration, this).
public long toSeconds (long duration)
  Equivalent to SECONDS.convert(duration, this).
public String toString () [Inherited From Enum]
  Returns the name of this enum constant, as contained in the declaration.
publicstatic T valueOf (Class< T> enumType, String name) [Inherited From Enum]
  Returns the enum constant of the specified enum type with the specified name.
publicstatic TimeUnit valueOf (String name)
publicfinalstatic TimeUnit values ()
pack-privatestatic long x (long d, long m, long over)
  Scale d by m, checking for overflow.
Fields
Hide/Show inherited fields
pack-privatefinalstatic long C0 = "1"
pack-privatefinalstatic long C1 = "1000"
pack-privatefinalstatic long C2 = "1000000"
pack-privatefinalstatic long C3 = "1000000000"
pack-privatefinalstatic long C4 = "60000000000"
pack-privatefinalstatic long C5 = "3600000000000"
pack-privatefinalstatic long C6 = "86400000000000"
pack-privatefinalstatic long MAX = "9223372036854775807"
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar