Skip to content

Commit a5c6906

Browse files
committed
fix(spanner): correct chrono arithmetic in Interval integration test (#15163)
1 parent 569ea8a commit a5c6906

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

google/cloud/spanner/integration_tests/data_types_integration_test.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,12 @@ TEST_F(DataTypeIntegrationTest, SelectIntervalFromTimestampDiff) {
533533
Interval expected_interval{
534534
std::chrono::duration_cast<std::chrono::nanoseconds>(
535535
std::chrono::hours(1))};
536+
auto const now_time_point = std::chrono::system_clock::now();
536537
std::time_t now_seconds =
537-
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
538-
std::time_t one_hour_later_seconds = now_seconds + 3600;
538+
std::chrono::system_clock::to_time_t(now_time_point);
539+
std::time_t one_hour_later_seconds =
540+
std::chrono::system_clock::to_time_t(
541+
now_time_point + std::chrono::hours(1));
539542

540543
std::vector<std::vector<Timestamp>> const data = {std::vector<Timestamp>{
541544
MakeTimestamp(MakeTime(now_seconds, 0)).value(),

0 commit comments

Comments
 (0)