Class/Object

com.google.protobuf.duration

Duration

Related Docs: object Duration | package duration

Permalink

final case class Duration(seconds: Long = 0L, nanos: Int = 0) extends trueaccord.scalapb.GeneratedMessage with trueaccord.scalapb.Message[Duration] with Updatable[Duration] with Product with Serializable

A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". It is related to Timestamp in that the difference between two Timestamp values is a Duration and it can be added or subtracted from a Timestamp. Range is approximately +-10,000 years.

Example 1: Compute Duration from two Timestamps in pseudo code.

Timestamp start = ...; Timestamp end = ...; Duration duration = ...;

duration.seconds = end.seconds - start.seconds; duration.nanos = end.nanos - start.nanos;

if (duration.seconds < 0 && duration.nanos > 0) { duration.seconds += 1; duration.nanos -= 1000000000; } else if (durations.seconds > 0 && duration.nanos < 0) { duration.seconds -= 1; duration.nanos += 1000000000; }

Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.

Timestamp start = ...; Duration duration = ...; Timestamp end = ...;

end.seconds = start.seconds + duration.seconds; end.nanos = start.nanos + duration.nanos;

if (end.nanos < 0) { end.seconds -= 1; end.nanos += 1000000000; } else if (end.nanos >= 1000000000) { end.seconds += 1; end.nanos -= 1000000000; }

seconds

Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive.

nanos

Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 seconds field and a positive or negative nanos field. For durations of one second or more, a non-zero value for the nanos field must be of the same sign as the seconds field. Must be from -999,999,999 to +999,999,999 inclusive.

Annotations
@SerialVersionUID()
Linear Supertypes
Product, Equals, Updatable[Duration], trueaccord.scalapb.Message[Duration], trueaccord.scalapb.GeneratedMessage, Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Duration
  2. Product
  3. Equals
  4. Updatable
  5. Message
  6. GeneratedMessage
  7. Serializable
  8. Serializable
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Duration(seconds: Long = 0L, nanos: Int = 0)

    Permalink

    seconds

    Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive.

    nanos

    Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 seconds field and a positive or negative nanos field. For durations of one second or more, a non-zero value for the nanos field must be of the same sign as the seconds field. Must be from -999,999,999 to +999,999,999 inclusive.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def companion: Duration.type

    Permalink
    Definition Classes
    DurationGeneratedMessage
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def getAllFields: Map[FieldDescriptor, Any]

    Permalink
    Definition Classes
    GeneratedMessage
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def getField(__field: FieldDescriptor): Any

    Permalink
    Definition Classes
    DurationGeneratedMessage
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. def mergeFrom(_input__: CodedInputStream): Duration

    Permalink
    Definition Classes
    DurationMessage
  14. val nanos: Int

    Permalink

    Signed fractions of a second at nanosecond resolution of the span of time.

    Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 seconds field and a positive or negative nanos field. For durations of one second or more, a non-zero value for the nanos field must be of the same sign as the seconds field. Must be from -999,999,999 to +999,999,999 inclusive.

  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. val seconds: Long

    Permalink

    Signed seconds of the span of time.

    Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive.

  19. final def serializedSize: Int

    Permalink
    Definition Classes
    DurationGeneratedMessage
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toByteArray: Array[Byte]

    Permalink
    Definition Classes
    GeneratedMessage
  22. def toString(): String

    Permalink
    Definition Classes
    Duration → AnyRef → Any
  23. def update(ms: (Lens[Duration, Duration]) ⇒ Mutation[Duration]*): Duration

    Permalink
    Definition Classes
    Updatable
  24. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. def withNanos(__v: Int): Duration

    Permalink
  28. def withSeconds(__v: Long): Duration

    Permalink
  29. def writeDelimitedTo(output: OutputStream): Unit

    Permalink
    Definition Classes
    GeneratedMessage
  30. def writeTo(_output__: CodedOutputStream): Unit

    Permalink
    Definition Classes
    DurationGeneratedMessage
  31. def writeTo(output: OutputStream): Unit

    Permalink
    Definition Classes
    GeneratedMessage

Inherited from Product

Inherited from Equals

Inherited from Updatable[Duration]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped