google.protobuf.timestamp_pb2

Generated protocol buffer code.

class google.protobuf.timestamp_pb2.Timestamp(**kwargs)
ByteSize()
Clear()
ClearExtension(extension_handle)

Clears the contents of a given extension.

Parameters:

extension_handle – The handle for the extension to clear.

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) – A 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”.

FromDatetime(dt)

Converts datetime to Timestamp.

Parameters:

dt – A datetime. If it’s timezone-naive, it’s assumed to be in UTC.

FromJsonString(value)

Parse a RFC 3339 date string format to Timestamp.

Parameters:

value – A date string. Any fractional digits (or none) and any offset are accepted as long as they fit into nano-seconds precision. Example of accepted format: ‘1972-01-01T10:00:20.021-05:00’

Raises:

ValueError – On parsing problems.

FromMicroseconds(micros)

Converts microseconds since epoch to Timestamp.

FromMilliseconds(millis)

Converts milliseconds since epoch to Timestamp.

FromNanoseconds(nanos)

Converts nanoseconds since epoch to Timestamp.

FromSeconds(seconds)

Converts seconds since epoch to Timestamp.

static FromString(s)
GetCurrentTime()

Get the current UTC into Timestamp.

HasExtension(extension_handle)

Checks if a certain extension is present for this message.

Extensions are retrieved using the Extensions mapping (if present).

Parameters:

extension_handle – The handle for the extension to check.

Returns:

Whether the extension is present for this message.

Return type:

bool

Raises:

KeyError – if the extension is repeated. Similar to repeated fields, there is no separate notion of presence: a “not present” repeated extension is an empty list.

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.

Raises:

message.DecodeError if the input cannot be parsed.

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.

ToDatetime(tzinfo=None)

Converts Timestamp to a datetime.

Parameters:

tzinfo – A datetime.tzinfo subclass; defaults to None.

Returns:

If tzinfo is None, returns a timezone-naive UTC datetime (with no timezone information, i.e. not aware that it’s UTC).

Otherwise, returns a timezone-aware datetime in the input timezone.

ToJsonString()

Converts Timestamp to RFC 3339 date string format.

Returns:

A string converted from timestamp. The string is always Z-normalized and uses 3, 6 or 9 fractional digits as required to represent the exact time. Example of the return format: ‘1972-01-01T10:00:20.021Z’

ToMicroseconds()

Converts Timestamp to microseconds since epoch.

ToMilliseconds()

Converts Timestamp to milliseconds since epoch.

ToNanoseconds()

Converts Timestamp to nanoseconds since epoch.

ToSeconds()

Converts Timestamp to seconds since epoch.

UnknownFields()
WhichOneof(oneof_name)

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

property nanos
property seconds