Implement USE_OS_TZDB for Android

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
Vasyl Gello authored and Howard Hinnant committed 2024-09-29 16:21:36 -04:00
1 parent ac0c58d5da
commit 3e43210885
2 files changed
+176 -4

No files matched your search

+12
View File
@@ -139,6 +139,11 @@ namespace date
enum class choose {earliest, latest};
#if defined(ANDROID) || defined(__ANDROID__)
struct tzdb;
static std::unique_ptr<tzdb> init_tzdb();
#endif // defined(ANDROID) || defined(__ANDROID__)
namespace detail
{
struct undocumented;
@@ -821,6 +826,10 @@ public:
#if !USE_OS_TZDB
DATE_API void add(const std::string& s);
#else
#if defined(ANDROID) || defined(__ANDROID__)
friend std::unique_ptr<tzdb> init_tzdb();
#endif // defined(ANDROID) || defined(__ANDROID__)
#endif // !USE_OS_TZDB
private:
@@ -844,6 +853,9 @@ private:
DATE_API void
load_data(std::istream& inf, std::int32_t tzh_leapcnt, std::int32_t tzh_timecnt,
std::int32_t tzh_typecnt, std::int32_t tzh_charcnt);
# if defined(ANDROID) || defined(__ANDROID__)
void parse_from_android_tzdata(std::ifstream& inf, const std::size_t off);
# endif // defined(ANDROID) || defined(__ANDROID__)
#else // !USE_OS_TZDB
DATE_API sys_info get_info_impl(sys_seconds tp, int tz_int) const;
DATE_API void adjust_infos(const std::vector<detail::Rule>& rules);