Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows for setting the time zone data base directory path at runtime. It does not yet work on Windows, because there might be some code that needs to be changed in the binary tzdb parser so that it works on Windows, but is a pre-requisite step towards that.
The first 3 commits are related to
<date>
changes, the rest of them are civil related changes to use the custom binary location to see if things work. I fully expect the github actions builds to break, that is unrelated to these changes.There is a new option
USE_BINARY_TZDB
.USE_OS_TZDB
can be thought of as a subset of this. IfUSE_BINARY_TZDB
is turned on, butUSE_OS_TZDB
is not, then the client is required to callset_tz_dir()
before initializing the tzdb, otherwise a runtime error is thrown.If
USE_BINARY_TZDB
is not defined, then it is set toUSE_OS_TZDB
to be compatible with all previous versions of date.Previously,
discover_tz_dir()
andget_tz_dir()
were always defined if on a non-Windows platform, even ifUSE_OS_TZDB
was not defined. I considered this a bug.discover_tz_dir()
is now only defined whenUSE_OS_TZDB
is on, andget_tz_dir()
is defined if eitherUSE_OS_TZDB
orUSE_BINARY_TZDB
is defined. It is required for this to be implemented this way to eventually add support forUSE_BINARY_TZDB
on Windows (i.e. we can't just turn off support for these when on Windows).I have changed the non-Windows implementation of
current_zone()
to only callget_tz_dir()
whenUSE_OS_TZDB
is on. This is a direct result of the previously mentioned change. It seemed like the call toget_tz_dir()
is only used in embedded systems and is related to a symlink to an OS tzdb path, so it really feels likeUSE_OS_TZDB
should have to be active for this to work. It would not be sufficient forUSE_BINARY_TZDB
to be on, because this could be a custom location that the symlink probably won't point to.