Skip to content

Commit

Permalink
apacheGH-44455: [C++] Update vendored date to 3.0.3
Browse files Browse the repository at this point in the history
IANA tzdata changed its data format. So we need to update vendored
date to parse it.
  • Loading branch information
kou committed Oct 21, 2024
1 parent 0c32067 commit 4c693e5
Show file tree
Hide file tree
Showing 13 changed files with 436 additions and 141 deletions.
4 changes: 2 additions & 2 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ endif()

set(ARROW_VENDORED_SRCS
vendored/base64.cpp
vendored/datetime/tz.cpp
vendored/datetime.cpp
vendored/double-conversion/bignum-dtoa.cc
vendored/double-conversion/bignum.cc
vendored/double-conversion/cached-powers.cc
Expand Down Expand Up @@ -488,7 +488,7 @@ set(ARROW_VENDORED_SRCS
if(APPLE)
list(APPEND ARROW_VENDORED_SRCS vendored/datetime/ios.mm)
endif()
set_source_files_properties(vendored/datetime/tz.cpp
set_source_files_properties(vendored/datetime.cpp
PROPERTIES SKIP_PRECOMPILE_HEADERS ON
SKIP_UNITY_BUILD_INCLUSION ON)
arrow_add_object_library(ARROW_VENDORED ${ARROW_VENDORED_SRCS})
Expand Down
19 changes: 19 additions & 0 deletions cpp/src/arrow/vendored/datetime.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

#include "datetime/visibility.h"
#include "datetime/tz.cpp"
7 changes: 4 additions & 3 deletions cpp/src/arrow/vendored/datetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

#pragma once

#include "arrow/vendored/datetime/date.h" // IWYU pragma: export
#include "arrow/vendored/datetime/tz.h" // IWYU pragma: export
#include "arrow/vendored/datetime/visibility.h" // IWYU pragma: export
#include "arrow/vendored/datetime/date.h" // IWYU pragma: export
#include "arrow/vendored/datetime/tz.h" // IWYU pragma: export

// Can be defined by date.h.
#ifdef NOEXCEPT
#undef NOEXCEPT
# undef NOEXCEPT
#endif
12 changes: 8 additions & 4 deletions cpp/src/arrow/vendored/datetime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ copies or substantial portions of the Software.
Sources for datetime are adapted from Howard Hinnant's date library
(https://github.com/HowardHinnant/date).

Sources are taken from changeset 1ead6715dec030d340a316c927c877a3c4e5a00c
Sources are taken from changeset 5bdb7e6f31fac909c090a46dbd9fea27b6e609a4
of the above project.

The following changes are made:
- fix internal inclusion paths (from "date/xxx.h" to simply "xxx.h")
- enclose the `date` namespace inside the `arrow_vendored` namespace
- include a custom "visibility.h" header from "tz.cpp" for proper DLL
exports on Windows
- disable curl-based database downloading in "tz.h"

## How to update

```console
$ cd cpp/src/arrow/vendored/datetime
$ ./update.sh 3.0.3
```
7 changes: 2 additions & 5 deletions cpp/src/arrow/vendored/datetime/date.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@
# pragma warning(disable : 4127)
#endif

namespace arrow_vendored
{
namespace date
namespace arrow_vendored::date
{

//---------------+
Expand Down Expand Up @@ -8234,8 +8232,7 @@ operator<<(std::basic_ostream<CharT, Traits>& os,
detail::get_units<CharT>(typename Period::type{});
}

} // namespace date
} // namespace arrow_vendored
} // namespace arrow_vendored::date

#ifdef _MSC_VER
# pragma warning(pop)
Expand Down
7 changes: 2 additions & 5 deletions cpp/src/arrow/vendored/datetime/ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
# if TARGET_OS_IPHONE
# include <string>

namespace arrow_vendored
{
namespace date
namespace arrow_vendored::date
{
namespace iOSUtils
{
Expand All @@ -43,8 +41,7 @@
std::string get_current_timezone();

} // namespace iOSUtils
} // namespace date
} // namespace arrow_vendored
} // namespace arrow_vendored::date

# endif // TARGET_OS_IPHONE
#else // !__APPLE__
Expand Down
7 changes: 2 additions & 5 deletions cpp/src/arrow/vendored/datetime/ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@
#define TAR_SIZE_POSITION 124
#define TAR_SIZE_SIZE 12

namespace arrow_vendored
{
namespace date
namespace arrow_vendored::date
{
namespace iOSUtils
{
Expand Down Expand Up @@ -334,7 +332,6 @@ bool writeFile(const std::string &tzdataPath, const std::string &fileName,
}

} // namespace iOSUtils
} // namespace date
} // namespace arrow_vendored
} // namespace arrow_vendored::date

#endif // TARGET_OS_IPHONE
Loading

0 comments on commit 4c693e5

Please sign in to comment.