Skip to content

Commit

Permalink
[C++] skip -0117 in StrptimeZoneOffset for old glibc
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Nov 11, 2024
1 parent 95b7181 commit 5a63821
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions cpp/src/arrow/util/value_parsing_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,26 @@ TEST(TimestampParser, StrptimeZoneOffset) {
std::string format = "%Y-%d-%m %H:%M:%S%z";
auto parser = TimestampParser::MakeStrptime(format);

std::vector<std::string> values = {
"2018-01-01 00:00:00+0000",
"2018-01-01 00:00:00+0100",
#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
# if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 28)
"2018-01-01 00:00:00-0117",
# else
// glibc < 2.28 doesn't support "-0117" timezone offset.
// See also: https://github.com/apache/arrow/issues/43808
# endif
#else
"2018-01-01 00:00:00-0117",
#endif
"2018-01-01 00:00:00+0130"
};

// N.B. GNU %z supports ISO8601 format while BSD %z supports only
// +HHMM or -HHMM and POSIX doesn't appear to define %z at all
for (auto unit : TimeUnit::values()) {
for (const std::string value :
{"2018-01-01 00:00:00+0000", "2018-01-01 00:00:00+0100",
"2018-01-01 00:00:00+0130", "2018-01-01 00:00:00-0117"}) {
for (const std::string& value : values) {
SCOPED_TRACE(value);
int64_t converted = 0;
int64_t expected = 0;
Expand Down

0 comments on commit 5a63821

Please sign in to comment.