arrow icon indicating copy to clipboard operation
arrow copied to clipboard

[C++][Gandiva] Use timegm in date_time_test utilities to avoid DST-dependent behavior

Open Reranko05 opened this issue 6 months ago • 1 comments

Describe the enhancement requested

Description

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

The existing Epoch() helper also contains a workaround for mktime() behavior on Windows/MSVC.

A cleaner approach is to use timegm() (and _mkgmtime() on Windows) so the test utilities consistently interpret timestamps as UTC.

This follow-up issue proposes:

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

This should make the datetime tests more deterministic and avoid environment-dependent DST behavior.

Follow-up from PR #49887 and issue #41605.

Component(s)

C++

Reranko05 avatar May 08 '26 19:05 Reranko05

Issue resolved by pull request 49953 https://github.com/apache/arrow/pull/49953

kou avatar Jun 05 '26 00:06 kou