webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Static Public Member Functions | Static Public Attributes | List of all members
com.google.protobuf.util.TimeUtil Class Reference

Static Public Member Functions

static String toString (Timestamp timestamp) throws IllegalArgumentException
 
static Timestamp parseTimestamp (String value) throws ParseException
 
static String toString (Duration duration) throws IllegalArgumentException
 
static Duration parseDuration (String value) throws ParseException
 
static Timestamp createTimestampFromMillis (long milliseconds)
 
static Duration createDurationFromMillis (long milliseconds)
 
static long toMillis (Timestamp timestamp)
 
static long toMillis (Duration duration)
 
static Timestamp createTimestampFromMicros (long microseconds)
 
static Duration createDurationFromMicros (long microseconds)
 
static long toMicros (Timestamp timestamp)
 
static long toMicros (Duration duration)
 
static Timestamp createTimestampFromNanos (long nanoseconds)
 
static Duration createDurationFromNanos (long nanoseconds)
 
static long toNanos (Timestamp timestamp)
 
static long toNanos (Duration duration)
 
static Timestamp getCurrentTime ()
 
static Timestamp getEpoch ()
 
static Duration distance (Timestamp from, Timestamp to)
 
static Timestamp add (Timestamp start, Duration length)
 
static Timestamp subtract (Timestamp start, Duration length)
 
static Duration add (Duration d1, Duration d2)
 
static Duration subtract (Duration d1, Duration d2)
 
static Duration multiply (Duration duration, double times)
 
static Duration divide (Duration duration, double value)
 
static Duration multiply (Duration duration, long times)
 
static Duration divide (Duration duration, long times)
 
static long divide (Duration d1, Duration d2)
 
static Duration remainder (Duration d1, Duration d2)
 

Static Public Attributes

static final long TIMESTAMP_SECONDS_MIN = -62135596800L
 
static final long TIMESTAMP_SECONDS_MAX = 253402300799L
 
static final long DURATION_SECONDS_MIN = -315576000000L
 
static final long DURATION_SECONDS_MAX = 315576000000L
 

Detailed Description

Utilities to help create/manipulate Timestamp/Duration

Member Function Documentation

◆ add() [1/2]

static Timestamp com.google.protobuf.util.TimeUtil.add ( Timestamp  start,
Duration  length 
)
inlinestatic

Add a duration to a timestamp.

◆ add() [2/2]

static Duration com.google.protobuf.util.TimeUtil.add ( Duration  d1,
Duration  d2 
)
inlinestatic

Add two durations.

◆ createDurationFromMicros()

static Duration com.google.protobuf.util.TimeUtil.createDurationFromMicros ( long  microseconds)
inlinestatic

Create a Duration from the number of microseconds.

◆ createDurationFromMillis()

static Duration com.google.protobuf.util.TimeUtil.createDurationFromMillis ( long  milliseconds)
inlinestatic

Create a Duration from the number of milliseconds.

◆ createDurationFromNanos()

static Duration com.google.protobuf.util.TimeUtil.createDurationFromNanos ( long  nanoseconds)
inlinestatic

Create a Duration from the number of nanoseconds.

◆ createTimestampFromMicros()

static Timestamp com.google.protobuf.util.TimeUtil.createTimestampFromMicros ( long  microseconds)
inlinestatic

Create a Timestamp from the number of microseconds elapsed from the epoch.

◆ createTimestampFromMillis()

static Timestamp com.google.protobuf.util.TimeUtil.createTimestampFromMillis ( long  milliseconds)
inlinestatic

Create a Timestamp from the number of milliseconds elapsed from the epoch.

◆ createTimestampFromNanos()

static Timestamp com.google.protobuf.util.TimeUtil.createTimestampFromNanos ( long  nanoseconds)
inlinestatic

Create a Timestamp from the number of nanoseconds elapsed from the epoch.

◆ distance()

static Duration com.google.protobuf.util.TimeUtil.distance ( Timestamp  from,
Timestamp  to 
)
inlinestatic

Calculate the difference between two timestamps.

◆ divide() [1/3]

static Duration com.google.protobuf.util.TimeUtil.divide ( Duration  duration,
double  value 
)
inlinestatic

◆ divide() [2/3]

static Duration com.google.protobuf.util.TimeUtil.divide ( Duration  duration,
long  times 
)
inlinestatic

◆ divide() [3/3]

static long com.google.protobuf.util.TimeUtil.divide ( Duration  d1,
Duration  d2 
)
inlinestatic

◆ getCurrentTime()

static Timestamp com.google.protobuf.util.TimeUtil.getCurrentTime ( )
inlinestatic

Get the current time.

◆ getEpoch()

static Timestamp com.google.protobuf.util.TimeUtil.getEpoch ( )
inlinestatic

Get the epoch.

◆ 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

◆ parseDuration()

static Duration com.google.protobuf.util.TimeUtil.parseDuration ( String  value) throws ParseException
inlinestatic

Parse from a string to produce a duration.

Returns
A Duration parsed from the string.
Exceptions
ParseExceptionif parsing fails.

◆ 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
ParseExceptionif parsing fails.

◆ remainder()

static Duration com.google.protobuf.util.TimeUtil.remainder ( Duration  d1,
Duration  d2 
)
inlinestatic

◆ subtract() [1/2]

static Timestamp com.google.protobuf.util.TimeUtil.subtract ( Timestamp  start,
Duration  length 
)
inlinestatic

Subtract a duration from a timestamp.

◆ subtract() [2/2]

static Duration com.google.protobuf.util.TimeUtil.subtract ( Duration  d1,
Duration  d2 
)
inlinestatic

Subtract a duration from another.

◆ toMicros() [1/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.

◆ toMicros() [2/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.

◆ toMillis() [1/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.

◆ toMillis() [2/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.

◆ toNanos() [1/2]

static long com.google.protobuf.util.TimeUtil.toNanos ( Timestamp  timestamp)
inlinestatic

Convert a Timestamp to the number of nanoseconds elapsed from the epoch.

◆ toNanos() [2/2]

static long com.google.protobuf.util.TimeUtil.toNanos ( Duration  duration)
inlinestatic

Convert a Duration to the number of nanoseconds.

◆ toString() [1/2]

static String com.google.protobuf.util.TimeUtil.toString ( Timestamp  timestamp) throws IllegalArgumentException
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
IllegalArgumentExceptionif the given timestamp is not in the valid range.

◆ toString() [2/2]

static String com.google.protobuf.util.TimeUtil.toString ( Duration  duration) throws IllegalArgumentException
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
IllegalArgumentExceptionif the given duration is not in the valid range.

Member Data Documentation

◆ 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

◆ 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: