libmuscle.timestamp module

class libmuscle.timestamp.Timestamp(seconds: float)[source]

Bases: object

A timestamp, as the number of seconds since the UNIX epoch.

Parameters

seconds – The number of seconds since the start of 1970.

static from_grpc(timestamp: Timestamp) Timestamp[source]

Creates a Timestamp from a gRPC Timestamp message.

Parameters

timestamp – A gRPC Timestamp from a gRPC call.

Returns

The same timestamp as a Timestamp object.

to_grpc() Timestamp[source]

Converts a Timestamp to the gRPC type.

Returns

The same timestamp, as a gRPC object.

to_rfc3339() str[source]

Converts a Timestamp to a datetime string.

Returns

The timestamp as a string.