From 0a9ce1bf51e8459793fb1906f865a69f4bf903cc Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Tue, 31 Aug 2021 09:06:13 -0600 Subject: [PATCH] chore(samples): use timezone aware datetimes (#121) See GoogleCloudPlatform/python-docs-samples#6581 --- samples/snippets/batch_write_spans.py | 2 +- samples/snippets/create_span_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/batch_write_spans.py b/samples/snippets/batch_write_spans.py index 965f5f88..9627c6a3 100644 --- a/samples/snippets/batch_write_spans.py +++ b/samples/snippets/batch_write_spans.py @@ -29,7 +29,7 @@ def batch_write_spans(project_id: str): trace_id = str(uuid.uuid4()).replace("-", "") span_id = str(uuid.uuid4()).replace("-", "")[:16] - end_time = datetime.datetime.now() + end_time = datetime.datetime.now(tz=datetime.timezone.utc) start_time = end_time - datetime.timedelta(seconds=5) # Create a single span diff --git a/samples/snippets/create_span_test.py b/samples/snippets/create_span_test.py index a419a80c..255bf35c 100644 --- a/samples/snippets/create_span_test.py +++ b/samples/snippets/create_span_test.py @@ -26,7 +26,7 @@ def test_get_trace(): trace_id = str(uuid.uuid4()).replace("-", "") span_id = str(uuid.uuid4()).replace("-", "")[:16] - end_time = datetime.datetime.now() + end_time = datetime.datetime.now(tz=datetime.timezone.utc) start_time = end_time - datetime.timedelta(seconds=5) span = create_span.create_span(