Skip to content

Commit

Permalink
GH-39841: [GLib] Add support for GLib 2.56 again (#39842)
Browse files Browse the repository at this point in the history
### Rationale for this change

It's still used in CentOS 7 and AlmaLinux 8.

### What changes are included in this PR?

Don't use `g_time_zone_get_identifier()` with GLib < 2.58.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* Closes: #39841

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
kou authored Jan 30, 2024
1 parent 63498c2 commit b778ace
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion c_glib/arrow-glib/basic-data-type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,8 @@ garrow_timestamp_data_type_class_init(GArrowTimestampDataTypeClass *klass)
/**
* garrow_timestamp_data_type_new:
* @unit: The unit of the timestamp data.
* @time_zone: (nullable): The time zone of the timestamp data.
* @time_zone: (nullable): The time zone of the timestamp data. If based GLib
* is less than 2.58, this is ignored.
*
* Returns: A newly created the number of
* seconds/milliseconds/microseconds/nanoseconds since UNIX epoch in
Expand All @@ -1226,9 +1227,11 @@ garrow_timestamp_data_type_new(GArrowTimeUnit unit,
{
auto arrow_unit = garrow_time_unit_to_raw(unit);
std::string arrow_timezone;
#if GLIB_CHECK_VERSION(2, 58, 0)
if (time_zone) {
arrow_timezone = g_time_zone_get_identifier(time_zone);
}
#endif
auto arrow_data_type = arrow::timestamp(arrow_unit, arrow_timezone);
auto data_type =
GARROW_TIMESTAMP_DATA_TYPE(g_object_new(GARROW_TYPE_TIMESTAMP_DATA_TYPE,
Expand Down

0 comments on commit b778ace

Please sign in to comment.