date's internal init_tzdb function iterates through the files provided
by the tz database, and init_tzdb contains a list of files that should
not be interpreted as being in TZif format.
The 2023d release of the tz database added a new file that is not in
TZif format, zonenow.tab. However, this file had not been added to the
ignore list.
This caused date to intepret the zonenow.tab file as a TZif file,
which caused assertions to fire in debug mode if the user attempted to
load its associated time_zone, causing load_header() to be invoked
on the file, which would find that it did not contain a 'TZif' magic
number.
This commit addresses the issue by adding the file to the ignore list.
The announcement on the tz database mailing list which describes the
addition of zonenow.tab can be found at this link:
https://mm.icann.org/pipermail/tz-announce/2023-December/000080.html
In commit commit 0b72599bd4 there
was a change to read "version" in addition to "+VERSION", so that
file shold also be ignored when scanning/reading zonefiles.
Also before the above mentioed commit get_version() would return
"unknown" if not on __APPLE__ and the version file was not found.
Put back that behaviour, for all USE_OS_TZDB users.
This last change changes the behaviour for __APPLE__ from throwing
an exception to returning "unknown".
Co-authored-by: Lars Gullik Bjønnes <lbjonnes@cisco.com>
Clang 9 (in Visual Studio) complains about a mixed signed-unsigned comparison and an unused function.
Replace the naked `int` constant -1 by `std::size_t(-1)` with the same codegen as before (no curlies to avoid narrowing).
Guard the definition of `get_download_folder()` by the same condition as its call-site.
Signed-off-by: Daniela Engert <dani@ngrt.de>
VS2019 correctly points out that a conversion from a wide NTCS to std::string requires narrowing. This may result in an undesired string value. Implement the string conversion properly.
Signed-off-by: Daniela Engert <dani@ngrt.de>
The include in tz.cpp was changed to only include the ios.h header
when compiling on apple platforms, as the documentation states that
only the four files date.h, tz.h, tz_private.h, and tz.cpp should be
required to use the time zone library.
Additionally, the ios.mm file was moved to src/ since it contains
C++ source code.