Skip to content

Commit 6096d41

Browse files
authored
GH-50399: [C++][Gandiva] Use timegm in DaysSince helper in Gandiva date_time_test (#50400)
### Rationale for this change DateTimeTestProjector.TestDateTime fails for me locally and it looks like the issue is that it's comparing datetimes calculated with two different methods: 1. Epoch(): Uses timegm as of #49953 2. DaysSince() was still using mktime ### What changes are included in this PR? Updated DaysSince() helper to use timegm to match other helpers so comparisons can be made without local time one handling issues. ### Are these changes tested? Yes. The test that fails locally now passes locally with this. ### Are there any user-facing changes? No. * GitHub Issue: #50399 Authored-by: Bryce Mecum <petridish@gmail.com> Signed-off-by: Bryce Mecum <petridish@gmail.com>
1 parent 5f6ee02 commit 6096d41

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cpp/src/gandiva/tests/date_time_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ int32_t DaysSince(time_t base_line, int32_t yy, int32_t mm, int32_t dd, int32_t
105105
given_ts.tm_min = min;
106106
given_ts.tm_sec = sec;
107107

108-
time_t ts = mktime(&given_ts);
108+
time_t ts = timegm(&given_ts);
109109
if (ts == static_cast<time_t>(-1)) {
110-
ARROW_LOG(FATAL) << "mktime() failed";
110+
ARROW_LOG(FATAL) << "timegm() failed";
111111
}
112112
// time_t is an arithmetic type on both POSIX and Windows, we can simply
113113
// subtract to get a duration in seconds.

0 commit comments

Comments
 (0)