Skip to content

Commit

Permalink
Build at package initialization time if required
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Jul 11, 2022
1 parent d4a1d3a commit c17814e
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit c17814e

Please sign in to comment.