Skip to content

Commit d72a254

Browse files
authored
fix: Fix timestamp proto util to default to timestamp at call time. (#933)
* fix: Fix timestamp proto util to default to timestamp at call time. * chore: lint
1 parent 1b7dbad commit d72a254

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

google/cloud/aiplatform/utils/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,15 +617,17 @@ def _timestamped_copy_to_gcs(
617617

618618

619619
def get_timestamp_proto(
620-
time: Optional[datetime.datetime] = datetime.datetime.now(),
620+
time: Optional[datetime.datetime] = None,
621621
) -> timestamp_pb2.Timestamp:
622622
"""Gets timestamp proto of a given time.
623623
Args:
624624
time (datetime.datetime):
625-
Required. A user provided time. Default to datetime.datetime.now() if not given.
625+
Optional. A user provided time. Default to datetime.datetime.now() if not given.
626626
Returns:
627-
timestamp_pb2.Timestamp - timestamp proto of the given time, not have higher than millisecond precision.
627+
timestamp_pb2.Timestamp: timestamp proto of the given time, not have higher than millisecond precision.
628628
"""
629+
if not time:
630+
time = datetime.datetime.now()
629631
t = time.timestamp()
630632
seconds = int(t)
631633
# must not have higher than millisecond precision.

0 commit comments

Comments
 (0)