Modifier and Type | Field and Description |
---|---|
static ClockTime |
NONE |
static ClockTime |
ZERO |
Modifier and Type | Method and Description |
---|---|
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.
|
public static ClockTime fromMicros(long microseconds)
microseconds
- The microsecond value to represent.public static ClockTime fromMillis(long milliseconds)
milliseconds
- The millisecond value to represent.public static ClockTime fromNanos(long nanoseconds)
nanoseconds
- The nanosecond value to represent.public static ClockTime fromSeconds(long seconds)
seconds
- The second value to represent.public static ClockTime valueOf(long time, java.util.concurrent.TimeUnit units)
time
- the length of time this object represents, in value.units
- the units time is expressed in.public long getHours()
public long getMinutes()
public long getSeconds()
public long getNanoSeconds()
public long convertTo(java.util.concurrent.TimeUnit unit)
unit
- the TimeUnit
to convertTo this time to.TimeUnit.convert(long, java.util.concurrent.TimeUnit)
public long toMicros()
ClockTime
.
This is a convenience wrapper, equivalent to:
convertTo(TimeUnit.MICROSECONDS)
ClockTime
.public long toMillis()
ClockTime
.
This is a convenience wrapper, equivalent to:
convertTo(TimeUnit.MILLISECONDS)
ClockTime
.public long toNanos()
ClockTime
.
This is a convenience wrapper, equivalent to:
convertTo(TimeUnit.NANOSECONDS)
ClockTime
.public long toSeconds()
ClockTime
.
This is a convenience wrapper, equivalent to:
convertTo(TimeUnit.SECONDS)
ClockTime
.public boolean isValid()
public java.lang.String toString()
String
representation of this ClockTime
.toString
in class java.lang.Object
ClockTime
public boolean equals(java.lang.Object obj)
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
equals
in class java.lang.Object
obj
- ClockTime
public int hashCode()
ClockTime
.hashCode
in class java.lang.Object
Long.hashCode()
public int compareTo(ClockTime time)
compareTo
in interface java.lang.Comparable<ClockTime>
time
- the other ClockTime to compare to.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.