google.protobuf.duration_pb2

class google.protobuf.duration_pb2.Duration(**kwargs)
ByteSize()
Clear()
ClearExtension(extension_handle)
ClearField(field_name)
CopyFrom(other_msg)

Copies the content of the specified message into the current message.

The method clears the current message and then merges the specified message using MergeFrom.

Parameters

other_msg – Message to copy into the current one.

DESCRIPTOR = <google.protobuf.descriptor.Descriptor object>
DiscardUnknownFields()
FindInitializationErrors()

Finds required fields which are not initialized.

Returns

A list of strings. Each string is a path to an uninitialized field from the top-level message, e.g. “foo.bar[5].baz”.

FromJsonString(value)

Converts a string to Duration.

Parameters

value – A string to be converted. The string must end with ‘s’. Any fractional digits (or none) are accepted as long as they fit into precision. For example: “1s”, “1.01s”, “1.0000001s”, “-3.100s

Raises

ValueError – On parsing problems.

FromMicroseconds(micros)

Converts microseconds to Duration.

FromMilliseconds(millis)

Converts milliseconds to Duration.

FromNanoseconds(nanos)

Converts nanoseconds to Duration.

FromSeconds(seconds)

Converts seconds to Duration.

static FromString(s)
FromTimedelta(td)

Converts timedelta to Duration.

HasExtension(extension_handle)
HasField(field_name)
IsInitialized(errors=None)

Checks if all required fields of a message are set.

Parameters

errors – A list which, if provided, will be populated with the field paths of all missing required fields.

Returns

True iff the specified message has all required fields set.

ListFields()
MergeFrom(msg)
MergeFromString(serialized)
NANOS_FIELD_NUMBER = 2
ParseFromString(serialized)

Parse serialized protocol buffer data into this message.

Like MergeFromString(), except we clear the object first.

static RegisterExtension(extension_handle)
SECONDS_FIELD_NUMBER = 1
SerializePartialToString(**kwargs)
SerializeToString(**kwargs)
SetInParent()

Sets the _cached_byte_size_dirty bit to true, and propagates this to our listener iff this was a state change.

ToJsonString()

Converts Duration to string format.

Returns

A string converted from self. 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”

ToMicroseconds()

Converts a Duration to microseconds.

ToMilliseconds()

Converts a Duration to milliseconds.

ToNanoseconds()

Converts a Duration to nanoseconds.

ToSeconds()

Converts a Duration to seconds.

ToTimedelta()

Converts Duration to timedelta.

UnknownFields()
WhichOneof(oneof_name)

Returns the name of the currently set field inside a oneof, or None.

property nanos
property seconds