protobuf/duration.proto. All operations throw an
IllegalArgumentException if the input(s) are not valid.
| Modifier and Type | Field and Description |
|---|---|
| private static final Comparator | |
| pack-priv static final long | |
| pack-priv static final long | |
| public static final Duration | |
| public static final Duration | |
| private static final long | |
| private static final long | |
| private static final long | |
| public static final Duration | ZERO
A constant holding the duration of zero. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | Returns: A valid, builtDuration.Builds the given builder and throws an |
| public static Comparator | |
| public static int | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static boolean | |
| public static boolean | |
| public static boolean | |
| pack-priv static Duration | |
| public static Duration | |
| public static Duration | |
| public static long | |
| public static long | |
| public static long | |
| public static long | |
| public static long | |
| public static long | |
| public static long | |
| public static double | toSecondsAsDouble(Duration duration)
Returns the number of seconds of the given duration as a |
| public static String |
| COMPARATOR | back to summary |
|---|---|
| private static final Comparator<Duration> COMPARATOR | |
| DURATION_SECONDS_MAX | back to summary |
|---|---|
| pack-priv static final long DURATION_SECONDS_MAX | |
| DURATION_SECONDS_MIN | back to summary |
|---|---|
| pack-priv static final long DURATION_SECONDS_MIN | |
| MAX_VALUE | back to summary |
|---|---|
| public static final Duration MAX_VALUE A constant holding the maximum valid | |
| MIN_VALUE | back to summary |
|---|---|
| public static final Duration MIN_VALUE A constant holding the minimum valid | |
| SECONDS_PER_DAY | back to summary |
|---|---|
| private static final long SECONDS_PER_DAY | |
| SECONDS_PER_HOUR | back to summary |
|---|---|
| private static final long SECONDS_PER_HOUR | |
| SECONDS_PER_MINUTE | back to summary |
|---|---|
| private static final long SECONDS_PER_MINUTE | |
| ZERO | back to summary |
|---|---|
| public static final Duration ZERO A constant holding the duration of zero. | |
| Durations | back to summary |
|---|---|
| private Durations() | |
| add | back to summary |
|---|---|
| public static Duration add(Duration d1, Duration d2) Add two durations. | |
| checkNotNegative | back to summary |
|---|---|
| public static Duration checkNotNegative(Duration duration) Ensures that the given
| |
| checkPositive | back to summary |
|---|---|
| public static Duration checkPositive(Duration duration) Ensures that the given
| |
| checkValid | back to summary |
|---|---|
| public static Duration checkValid(Duration duration) Throws an
| |
| checkValid | back to summary |
|---|---|
| public static Duration checkValid(Duration. Builds the given builder and throws an | |
| comparator | back to summary |
|---|---|
| public static Comparator Returns a | |
| compare | back to summary |
|---|---|
| public static int compare(Duration x, Duration y) Compares two durations. The value returned is identical to what would be returned by:
| |
| fromDays | back to summary |
|---|---|
| public static Duration fromDays(long days) Create a Duration from the number of days.
| |
| fromHours | back to summary |
|---|---|
| public static Duration fromHours(long hours) Create a Duration from the number of hours.
| |
| fromMicros | back to summary |
|---|---|
| public static Duration fromMicros(long microseconds) Create a Duration from the number of microseconds.
| |
| fromMillis | back to summary |
|---|---|
| public static Duration fromMillis(long milliseconds) Create a Duration from the number of milliseconds.
| |
| fromMinutes | back to summary |
|---|---|
| public static Duration fromMinutes(long minutes) Create a Duration from the number of minutes.
| |
| fromNanos | back to summary |
|---|---|
| public static Duration fromNanos(long nanoseconds) Create a Duration from the number of nanoseconds.
| |
| fromSeconds | back to summary |
|---|---|
| public static Duration fromSeconds(long seconds) Create a Duration from the number of seconds.
| |
| isNegative | back to summary |
|---|---|
| public static boolean isNegative(Duration duration) Returns whether the given | |
| isValid | back to summary |
|---|---|
| public static boolean isValid(Duration duration) Returns true if the given Note Durations less than one second are represented with a 0 | |
| isValid | back to summary |
|---|---|
| public static boolean isValid(long seconds, int nanos) Returns true if the given number of seconds and nanos is a valid Note Durations less than one second are represented with a 0
| |
| normalizedDuration | back to summary |
|---|---|
| pack-priv static Duration normalizedDuration(long seconds, int nanos) | |
| parse | back to summary |
|---|---|
| public static Duration parse(String value) throws ParseException Parse from a string to produce a duration.
| |
| subtract | back to summary |
|---|---|
| public static Duration subtract(Duration d1, Duration d2) Subtract a duration from another. | |
| toDays | back to summary |
|---|---|
| public static long toDays(Duration duration) Convert a Duration to the number of days. The result will be rounded towards 0 to the nearest day.
| |
| toHours | back to summary |
|---|---|
| public static long toHours(Duration duration) Convert a Duration to the number of hours. The result will be rounded towards 0 to the nearest hour.
| |
| toMicros | back to summary |
|---|---|
| public static long toMicros(Duration duration) Convert a Duration to the number of microseconds. The result will be rounded towards 0 to the nearest microseconds. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
| |
| toMillis | back to summary |
|---|---|
| public static long toMillis(Duration duration) Convert a Duration to the number of milliseconds. The result will be rounded towards 0 to the nearest millisecond. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
| |
| toMinutes | back to summary |
|---|---|
| public static long toMinutes(Duration duration) Convert a Duration to the number of minutes. The result will be rounded towards 0 to the nearest minute.
| |
| toNanos | back to summary |
|---|---|
| public static long toNanos(Duration duration) Convert a Duration to the number of nanoseconds.
| |
| toSeconds | back to summary |
|---|---|
| public static long toSeconds(Duration duration) Convert a Duration to the number of seconds. The result will be rounded towards 0 to the nearest second. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
| |
| toSecondsAsDouble | back to summary |
|---|---|
| public static double toSecondsAsDouble(Duration duration) Returns the number of seconds of the given duration as a This conversion may lose precision. If you need the number of seconds in this duration as a
| |
| toString | back to summary |
|---|---|
| public static String toString(Duration duration) Convert Duration to string format. The string format will contains 3, 6, or 9 fractional digits depending on the precision required to represent the exact Duration value. For example: "1s", "1.010s", "1.000000100s", "-3.100s" The range that can be represented by Duration is from -315,576,000,000 to +315,576,000,000 inclusive (in seconds).
| |