Skip to content

GH-49952: [C++][Gandiva] Use timegm in date_time_test utilities#49953

Open
Reranko05 wants to merge 1 commit intoapache:mainfrom
Reranko05:gandiva-timegm-cleanup
Open

GH-49952: [C++][Gandiva] Use timegm in date_time_test utilities#49953
Reranko05 wants to merge 1 commit intoapache:mainfrom
Reranko05:gandiva-timegm-cleanup

Conversation

@Reranko05
Copy link
Copy Markdown
Contributor

@Reranko05 Reranko05 commented May 8, 2026

Rationale for this change

As discussed in PR #49887, the Gandiva datetime test utilities currently use mktime(), which interprets timestamps as local time and can behave differently across platforms and DST boundaries.

This PR switches the test utilities to timegm() so timestamps are interpreted consistently as UTC. This also removes the existing workaround logic in Epoch() that was previously needed for mktime() behavior on Windows/MSVC.

What changes are included in this PR?

  • replaced mktime() with timegm() in date_time_test.cc
  • added a small Windows compatibility mapping for _mkgmtime
  • removed the existing DST/localtime workaround logic in Epoch()

Are these changes tested?

  • Re-ran DateTimeTestProjector.TestFromUtcTimestamp repeatedly locally
  • Re-ran the full gandiva-projector-test suite successfully

Are there any user-facing changes?

No.

Github Issue: #49952

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

⚠️ GitHub issue #49952 has been automatically assigned in GitHub to PR creator.

@Reranko05
Copy link
Copy Markdown
Contributor Author

@lriggs I tried the timegm() approach suggested in #49887 locally and opened this follow-up PR based on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant