public class Duration extends TimeBase<Duration>
| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE
The primitive type.
|
FIELD_NSECS, FIELD_SECS, MILLI_TO_NSECS, MILLI_TO_SECS, nsecs, NSECS_TO_MILLI, NSECS_TO_SECS, secs, SECS_TO_MILLI, SECS_TO_NSECSEMPTY_MESSAGEEMPTY_JSON| Constructor and Description |
|---|
Duration()
Create a new Duration with a default of 0.
|
Duration(double sec)
Create a new Duration with the given duration in seconds (and partial
seconds).
|
Duration(int secs,
int nsecs)
Create a new Duration with the given seconds and nanoseconds values.
|
Duration(long nano)
Create a new Duration with the given duration in nanoseconds.
|
| Modifier and Type | Method and Description |
|---|---|
Duration |
add(Duration d)
Add the given Duration to this Duration and return a new Duration with
that value.
|
Duration |
clone()
Create a clone of this Duration.
|
static Duration |
fromJsonObject(javax.json.JsonObject jsonObject)
Create a new Duration based on the given JSON object.
|
static Duration |
fromJsonString(String jsonString)
Create a new Duration based on the given JSON string.
|
static Duration |
fromNano(long nano)
Create a new Duration message based on the given nanoseconds.
|
static Duration |
fromSec(double sec)
Create a new Duration message based on the given seconds.
|
boolean |
sleep()
Attempt to sleep for the duration specified in this object.
|
Duration |
subtract(Duration d)
Subtract the given Duration from this Duration and return a new Duration
with that value.
|
compareTo, getNsecs, getSecs, isZero, toNSec, toSecfromUInt16, fromUInt16, fromUInt32, fromUInt32, fromUInt64, fromUInt64, fromUInt8, fromUInt8, getPrimitiveType, setPrimitiveType, toUInt16, toUInt16, toUInt32, toUInt32, toUInt64, toUInt64, toUInt8, toUInt8equals, hashCode, toJsonObject, toStringpublic static final String TYPE
public Duration()
public Duration(int secs,
int nsecs)
secs - The seconds value of this duration.nsecs - The nanoseconds value of this duration.public Duration(double sec)
sec - The duration in seconds.public Duration(long nano)
sec - The duration in nanoseconds.public Duration add(Duration d)
public Duration subtract(Duration d)
public boolean sleep()
public Duration clone()
public static Duration fromSec(double sec)
sec - The duration in seconds.public static Duration fromNano(long nano)
nano - The duration in nanoseconds.public static Duration fromJsonString(String jsonString)
jsonString - The JSON string to parse.public static Duration fromJsonObject(javax.json.JsonObject jsonObject)
jsonObject - The JSON object to parse.Copyright © 2014. All rights reserved.