Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build at package initialization time (if required) #390

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/TimeZones.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ const _COMPILED_DIR = Ref{String}()
abstract type Local <: TimeZone end

function __init__()
# Write out our compiled tzdata representations into a scratchspace
_COMPILED_DIR[] = _compiled_dir(tzdata_version())

# Initialize the thread-local TimeZone cache (issue #342)
_reset_tz_cache()

# Write out our compiled tzdata representations into a scratchspace
version = tzdata_version()
_COMPILED_DIR[] = _compiled_dir(version)

# Build the time zone data if required. Should only occur when `JULIA_TZ_VERSION` is
# specified we to a version not previously built.
isdir(_COMPILED_DIR[]) || build(version)

# Base extension needs to happen everytime the module is loaded (issue #24)
Dates.CONVERSION_SPECIFIERS['z'] = TimeZone
Dates.CONVERSION_SPECIFIERS['Z'] = TimeZone
Expand Down