com.google.protobuf.duration

Duration

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( 0L )
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
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

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

    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: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

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

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

    Definition Classes
    AnyRef
  10. def finalize(): Unit

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

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

    Definition Classes
    AnyRef → Any
  13. def getField(__field: FieldDescriptor): PValue

    Definition Classes
    DurationGeneratedMessage
  14. def getField(field: FieldDescriptor): Any

    Definition Classes
    GeneratedMessage
  15. def getFieldByNumber(__fieldNumber: Int): Any

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

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

    Definition Classes
    DurationMessage
  18. val nanos: Int

    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.

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

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. val seconds: Long

    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.

  23. final def serializedSize: Int

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

    Definition Classes
    AnyRef
  25. def toByteArray: Array[Byte]

    Definition Classes
    GeneratedMessage
  26. def toByteString: ByteString

    Definition Classes
    GeneratedMessage
  27. def toPMessage: PMessage

    Definition Classes
    GeneratedMessage
  28. def toString(): String

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

    Definition Classes
    Updatable
  30. final def wait(): Unit

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

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

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

  34. def withSeconds(__v: Long): Duration

  35. def writeDelimitedTo(output: OutputStream): Unit

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

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

    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