|
static Duration | add (Duration d1, Duration d2) |
|
static Timestamp | add (Timestamp start, Duration length) |
|
static Duration | createDurationFromMicros (long microseconds) |
|
static Duration | createDurationFromMillis (long milliseconds) |
|
static Duration | createDurationFromNanos (long nanoseconds) |
|
static Timestamp | createTimestampFromMicros (long microseconds) |
|
static Timestamp | createTimestampFromMillis (long milliseconds) |
|
static Timestamp | createTimestampFromNanos (long nanoseconds) |
|
static Duration | distance (Timestamp from, Timestamp to) |
|
static long | divide (Duration d1, Duration d2) |
|
static Duration | divide (Duration duration, double value) |
|
static Duration | divide (Duration duration, long times) |
|
static Timestamp | getCurrentTime () |
|
static Timestamp | getEpoch () |
|
static Duration | multiply (Duration duration, double times) |
|
static Duration | multiply (Duration duration, long times) |
|
static Duration | parseDuration (String value) throws ParseException |
|
static Timestamp | parseTimestamp (String value) throws ParseException |
|
static Duration | remainder (Duration d1, Duration d2) |
|
static Duration | subtract (Duration d1, Duration d2) |
|
static Timestamp | subtract (Timestamp start, Duration length) |
|
static long | toMicros (Duration duration) |
|
static long | toMicros (Timestamp timestamp) |
|
static long | toMillis (Duration duration) |
|
static long | toMillis (Timestamp timestamp) |
|
static long | toNanos (Duration duration) |
|
static long | toNanos (Timestamp timestamp) |
|
static String | toString (Duration duration) |
|
static String | toString (Timestamp timestamp) |
|
Utilities to help create/manipulate Timestamp/Duration
- Deprecated:
- Use Durations and Timestamps instead.
Definition at line 45 of file TimeUtil.java.
◆ TimeUtil()
com.google.protobuf.util.TimeUtil.TimeUtil |
( |
| ) |
|
|
inlineprivate |
◆ add() [1/2]
◆ add() [2/2]
◆ createDurationFromBigInteger()
static Duration com.google.protobuf.util.TimeUtil.createDurationFromBigInteger |
( |
BigInteger |
value | ) |
|
|
inlinestaticprivate |
◆ createDurationFromMicros()
static Duration com.google.protobuf.util.TimeUtil.createDurationFromMicros |
( |
long |
microseconds | ) |
|
|
inlinestatic |
◆ createDurationFromMillis()
static Duration com.google.protobuf.util.TimeUtil.createDurationFromMillis |
( |
long |
milliseconds | ) |
|
|
inlinestatic |
◆ createDurationFromNanos()
static Duration com.google.protobuf.util.TimeUtil.createDurationFromNanos |
( |
long |
nanoseconds | ) |
|
|
inlinestatic |
◆ createTimestampFromMicros()
static Timestamp com.google.protobuf.util.TimeUtil.createTimestampFromMicros |
( |
long |
microseconds | ) |
|
|
inlinestatic |
◆ createTimestampFromMillis()
static Timestamp com.google.protobuf.util.TimeUtil.createTimestampFromMillis |
( |
long |
milliseconds | ) |
|
|
inlinestatic |
◆ createTimestampFromNanos()
static Timestamp com.google.protobuf.util.TimeUtil.createTimestampFromNanos |
( |
long |
nanoseconds | ) |
|
|
inlinestatic |
◆ distance()
◆ divide() [1/3]
static long com.google.protobuf.util.TimeUtil.divide |
( |
Duration |
d1, |
|
|
Duration |
d2 |
|
) |
| |
|
inlinestatic |
◆ divide() [2/3]
static Duration com.google.protobuf.util.TimeUtil.divide |
( |
Duration |
duration, |
|
|
double |
value |
|
) |
| |
|
inlinestatic |
◆ divide() [3/3]
static Duration com.google.protobuf.util.TimeUtil.divide |
( |
Duration |
duration, |
|
|
long |
times |
|
) |
| |
|
inlinestatic |
◆ getCurrentTime()
static Timestamp com.google.protobuf.util.TimeUtil.getCurrentTime |
( |
| ) |
|
|
inlinestatic |
Get the current time.
- Deprecated:
- Use
Timestamps.fromMillis(System.currentTimeMillis())
instead.
Definition at line 261 of file TimeUtil.java.
◆ getEpoch()
static Timestamp com.google.protobuf.util.TimeUtil.getEpoch |
( |
| ) |
|
|
inlinestatic |
◆ multiply() [1/2]
static Duration com.google.protobuf.util.TimeUtil.multiply |
( |
Duration |
duration, |
|
|
double |
times |
|
) |
| |
|
inlinestatic |
◆ multiply() [2/2]
static Duration com.google.protobuf.util.TimeUtil.multiply |
( |
Duration |
duration, |
|
|
long |
times |
|
) |
| |
|
inlinestatic |
◆ normalizedDuration()
static Duration com.google.protobuf.util.TimeUtil.normalizedDuration |
( |
long |
seconds, |
|
|
int |
nanos |
|
) |
| |
|
inlinestaticprivate |
◆ parseDuration()
static Duration com.google.protobuf.util.TimeUtil.parseDuration |
( |
String |
value | ) |
throws ParseException |
|
inlinestatic |
◆ parseTimestamp()
static Timestamp com.google.protobuf.util.TimeUtil.parseTimestamp |
( |
String |
value | ) |
throws ParseException |
|
inlinestatic |
Parse from RFC 3339 date string to Timestamp. This method accepts all outputs of toString(Timestamp) and it also accepts any fractional digits (or none) and any offset as long as they fit into nano-seconds precision.
Example of accepted format: "1972-01-01T10:00:20.021-05:00"
- Returns
- A Timestamp parsed from the string.
- Exceptions
-
ParseException | if parsing fails. |
- Deprecated:
- Use Timestamps#parse instead.
Definition at line 90 of file TimeUtil.java.
◆ remainder()
◆ subtract() [1/2]
◆ subtract() [2/2]
◆ toBigInteger() [1/2]
static BigInteger com.google.protobuf.util.TimeUtil.toBigInteger |
( |
Duration |
duration | ) |
|
|
inlinestaticprivate |
◆ toBigInteger() [2/2]
static BigInteger com.google.protobuf.util.TimeUtil.toBigInteger |
( |
long |
value | ) |
|
|
inlinestaticprivate |
◆ toMicros() [1/2]
static long com.google.protobuf.util.TimeUtil.toMicros |
( |
Duration |
duration | ) |
|
|
inlinestatic |
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.
- Deprecated:
- Use Durations#toMicros instead.
Definition at line 211 of file TimeUtil.java.
◆ toMicros() [2/2]
static long com.google.protobuf.util.TimeUtil.toMicros |
( |
Timestamp |
timestamp | ) |
|
|
inlinestatic |
Convert a Timestamp to the number of microseconds elapsed from the epoch.
The result will be rounded down to the nearest microsecond. E.g., if the timestamp represents "1969-12-31T23:59:59.999999999Z", it will be rounded to -1 millisecond.
- Deprecated:
- Use Timestamps#toMicros instead.
Definition at line 199 of file TimeUtil.java.
◆ toMillis() [1/2]
static long com.google.protobuf.util.TimeUtil.toMillis |
( |
Duration |
duration | ) |
|
|
inlinestatic |
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.
- Deprecated:
- Use Durations#toMillis instead.
Definition at line 165 of file TimeUtil.java.
◆ toMillis() [2/2]
static long com.google.protobuf.util.TimeUtil.toMillis |
( |
Timestamp |
timestamp | ) |
|
|
inlinestatic |
Convert a Timestamp to the number of milliseconds elapsed from the epoch.
The result will be rounded down to the nearest millisecond. E.g., if the timestamp represents "1969-12-31T23:59:59.999999999Z", it will be rounded to -1 millisecond.
- Deprecated:
- Use Timestamps#toMillis instead.
Definition at line 153 of file TimeUtil.java.
◆ toNanos() [1/2]
static long com.google.protobuf.util.TimeUtil.toNanos |
( |
Duration |
duration | ) |
|
|
inlinestatic |
◆ toNanos() [2/2]
static long com.google.protobuf.util.TimeUtil.toNanos |
( |
Timestamp |
timestamp | ) |
|
|
inlinestatic |
◆ toString() [1/2]
static String com.google.protobuf.util.TimeUtil.toString |
( |
Duration |
duration | ) |
|
|
inlinestatic |
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).
- Returns
- The string representation of the given duration.
- Exceptions
-
IllegalArgumentException | if the given duration is not in the valid range. |
- Deprecated:
- Use Durations#toString instead.
Definition at line 107 of file TimeUtil.java.
◆ toString() [2/2]
static String com.google.protobuf.util.TimeUtil.toString |
( |
Timestamp |
timestamp | ) |
|
|
inlinestatic |
Convert Timestamp to RFC 3339 date string format. The output will always be Z-normalized and uses 3, 6 or 9 fractional digits as required to represent the exact value. Note that Timestamp can only represent time from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. See https://www.ietf.org/rfc/rfc3339.txt
Example of generated format: "1972-01-01T10:00:20.021Z"
- Returns
- The string representation of the given timestamp.
- Exceptions
-
IllegalArgumentException | if the given timestamp is not in the valid range. |
- Deprecated:
- Use Timestamps#toString instead.
Definition at line 73 of file TimeUtil.java.
◆ DURATION_SECONDS_MAX
final long com.google.protobuf.util.TimeUtil.DURATION_SECONDS_MAX = 315576000000L |
|
static |
◆ DURATION_SECONDS_MIN
final long com.google.protobuf.util.TimeUtil.DURATION_SECONDS_MIN = -315576000000L |
|
static |
◆ NANOS_PER_SECOND
final long com.google.protobuf.util.TimeUtil.NANOS_PER_SECOND = 1000000000 |
|
staticprivate |
◆ NANOS_PER_SECOND_BIG_INTEGER
final BigInteger com.google.protobuf.util.TimeUtil.NANOS_PER_SECOND_BIG_INTEGER |
|
staticprivate |
◆ TIMESTAMP_SECONDS_MAX
final long com.google.protobuf.util.TimeUtil.TIMESTAMP_SECONDS_MAX = 253402300799L |
|
static |
◆ TIMESTAMP_SECONDS_MIN
final long com.google.protobuf.util.TimeUtil.TIMESTAMP_SECONDS_MIN = -62135596800L |
|
static |
The documentation for this class was generated from the following file: