diff --git a/google/cloud/aiplatform/utils/__init__.py b/google/cloud/aiplatform/utils/__init__.py index acfde30aea..26b28dcdd7 100644 --- a/google/cloud/aiplatform/utils/__init__.py +++ b/google/cloud/aiplatform/utils/__init__.py @@ -617,15 +617,17 @@ def _timestamped_copy_to_gcs( def get_timestamp_proto( - time: Optional[datetime.datetime] = datetime.datetime.now(), + time: Optional[datetime.datetime] = None, ) -> timestamp_pb2.Timestamp: """Gets timestamp proto of a given time. Args: time (datetime.datetime): - Required. A user provided time. Default to datetime.datetime.now() if not given. + Optional. A user provided time. Default to datetime.datetime.now() if not given. Returns: - timestamp_pb2.Timestamp - timestamp proto of the given time, not have higher than millisecond precision. + timestamp_pb2.Timestamp: timestamp proto of the given time, not have higher than millisecond precision. """ + if not time: + time = datetime.datetime.now() t = time.timestamp() seconds = int(t) # must not have higher than millisecond precision.