org.gstreamer
Class ClockTime

java.lang.Object
  extended by org.gstreamer.ClockTime
All Implemented Interfaces:
java.lang.Comparable<ClockTime>

public final class ClockTime
extends java.lang.Object
implements java.lang.Comparable<ClockTime>

A representation of time in the gstreamer framework.


Field Summary
static ClockTime NONE
           
static ClockTime ZERO
           
 
Method Summary
 int compareTo(ClockTime time)
          Compares this ClockTime to another.
 long convertTo(java.util.concurrent.TimeUnit unit)
          Converts this ClockTime to a time value of unit units.
 boolean equals(java.lang.Object obj)
          Compares this ClockTime to the specified object.
static ClockTime fromMicros(long microseconds)
          Creates a new ClockTime object for a microsecond value.
static ClockTime fromMillis(long milliseconds)
          Creates a new ClockTime object for a millisecond value.
static ClockTime fromNanos(long nanoseconds)
          Creates a new ClockTime object for a nanosecond value.
static ClockTime fromSeconds(long seconds)
          Creates a new ClockTime object for a second value.
 long getHours()
          Get the hours component of the total time.
 long getMinutes()
          Get the minutes component of the total time.
 long getNanoSeconds()
          Get the nanosecond component of the total time.
 long getSeconds()
          Get the seconds component of the total time.
 int hashCode()
          Returns a hash code for this ClockTime.
 boolean isValid()
          Determines if this ClockTime represents a valid time value.
 long toMicros()
          Gets the total number of microseconds represented by this ClockTime.
 long toMillis()
          Gets the total number of milliseconds represented by this ClockTime.
 long toNanos()
          Gets the total number of value represented by this ClockTime.
 long toSeconds()
          Gets the total number of seconds represented by this ClockTime.
 java.lang.String toString()
          Returns a String representation of this ClockTime.
static ClockTime valueOf(long time, java.util.concurrent.TimeUnit units)
          Returns a new ClockTime object that represents the time value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final ClockTime NONE

ZERO

public static final ClockTime ZERO
Method Detail

fromMicros

public static ClockTime fromMicros(long microseconds)
Creates a new ClockTime object for a microsecond value.

Parameters:
microseconds - The microsecond value to represent.
Returns:
The new ClockTime object.

fromMillis

public static ClockTime fromMillis(long milliseconds)
Creates a new ClockTime object for a millisecond value.

Parameters:
milliseconds - The millisecond value to represent.
Returns:
The new ClockTime object.

fromNanos

public static ClockTime fromNanos(long nanoseconds)
Creates a new ClockTime object for a nanosecond value.

Parameters:
nanoseconds - The nanosecond value to represent.
Returns:
The new ClockTime object.

fromSeconds

public static ClockTime fromSeconds(long seconds)
Creates a new ClockTime object for a second value.

Parameters:
seconds - The second value to represent.
Returns:
The new ClockTime object.

valueOf

public static ClockTime valueOf(long time,
                                java.util.concurrent.TimeUnit units)
Returns a new ClockTime object that represents the time value.

Parameters:
time - the length of time this object represents, in value.
units - the units time is expressed in.
Returns:
The new ClockTime object.

getHours

public long getHours()
Get the hours component of the total time.

Returns:
The hours component of the total time.

getMinutes

public long getMinutes()
Get the minutes component of the total time.

Returns:
The minutes component of the total time.

getSeconds

public long getSeconds()
Get the seconds component of the total time.

Returns:
The seconds component of the total time.

getNanoSeconds

public long getNanoSeconds()
Get the nanosecond component of the total time.

Returns:
The value component of the total time.

convertTo

public long convertTo(java.util.concurrent.TimeUnit unit)
Converts this ClockTime to a time value of unit units.

Parameters:
unit - the TimeUnit to convertTo this time to.
Returns:
the total time represented by this ClockTime.
See Also:
TimeUnit.convert(long, java.util.concurrent.TimeUnit)

toMicros

public long toMicros()
Gets the total number of microseconds represented by this ClockTime.

This is a convenience wrapper, equivalent to:

convertTo(TimeUnit.MICROSECONDS)

Returns:
The total microseconds represented by this ClockTime.

toMillis

public long toMillis()
Gets the total number of milliseconds represented by this ClockTime.

This is a convenience wrapper, equivalent to:

convertTo(TimeUnit.MILLISECONDS)

Returns:
The total milliseconds represented by this ClockTime.

toNanos

public long toNanos()
Gets the total number of value represented by this ClockTime.

This is a convenience wrapper, equivalent to:

convertTo(TimeUnit.NANOSECONDS)

Returns:
The total value represented by this ClockTime.

toSeconds

public long toSeconds()
Gets the total number of seconds represented by this ClockTime.

This is a convenience wrapper, equivalent to:

convertTo(TimeUnit.SECONDS)

Returns:
The total seconds represented by this ClockTime.

isValid

public boolean isValid()
Determines if this ClockTime represents a valid time value.

Returns:
true if valid, else false

toString

public java.lang.String toString()
Returns a String representation of this ClockTime.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this ClockTime

equals

public boolean equals(java.lang.Object obj)
Compares this ClockTime to the specified object.

The result is true if and only if the argument is not null and is a ClockTime object equivalent to this ClockTime

Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:
true if the specified object is equivalent to this ClockTime

hashCode

public int hashCode()
Returns a hash code for this ClockTime.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this ClockTime.
See Also:
Long.hashCode()

compareTo

public int compareTo(ClockTime time)
Compares this ClockTime to another.

Specified by:
compareTo in interface java.lang.Comparable<ClockTime>
Parameters:
time - the other ClockTime to compare to.
Returns:
0 if this ClockTime is equal to time. A value less than zero if this ClockTime is numerically less than time. A value greater than zero if this ClockTime is numerically greater than time.