Skip to content

Commit

Permalink
Switch time zone data to global-tz
Browse files Browse the repository at this point in the history
  • Loading branch information
jodastephen committed Mar 20, 2022
1 parent e9337f0 commit b654344
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 24 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/tzdbupdate.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: TZDB check

on:
push:
branches:
- 'master'
schedule:
- cron: '0 3 * * 1,2,3,5'
- cron: '50 1 * * *'

jobs:
tzdbcheck:
Expand All @@ -13,6 +16,7 @@ jobs:
uses: actions/checkout@v2
with:
token: ${{ secrets.PERSONAL_TOKEN_GH }}

- name: Maven cache
uses: actions/cache@v1
with:
Expand All @@ -25,6 +29,7 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Maven version
run: |
mkdir -p ./.mvn
Expand All @@ -37,14 +42,17 @@ jobs:
CURRENT_TZDB=$(mvn help:evaluate -Dexpression=tz.database.version -q -DforceStdout)
echo "current: $CURRENT_TZDB"
echo "CURRENT_TZDB=$CURRENT_TZDB" >> $GITHUB_ENV
- name: Get latest version
working-directory: target
run: |
git clone https://github.com/JodaOrg/tz.git
git clone https://github.com/JodaOrg/global-tz.git tz
cd tz
git checkout global-tz
LATEST_TZDB=$(git describe --abbrev=0 --tags)
echo "latest: $LATEST_TZDB"
echo "LATEST_TZDB=$LATEST_TZDB" >> $GITHUB_ENV
- name: Compare versions
run: |
echo "current: $CURRENT_TZDB"
Expand All @@ -55,9 +63,10 @@ jobs:
if: env.NOOP != 'true'
working-directory: target/tz
run: |
git checkout main
git checkout global-tz
git reset --hard ${LATEST_TZDB} --
git status
- name: Copy files
if: env.NOOP != 'true'
run: |
Expand All @@ -72,6 +81,7 @@ jobs:
\cp target/tz/northamerica src/main/java/org/joda/time/tz/src
\cp target/tz/southamerica src/main/java/org/joda/time/tz/src
ls -l src/main/java/org/joda/time/tz/src
- name: Update build with new tzdb
if: env.NOOP != 'true'
run: |
Expand All @@ -87,11 +97,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN_GH }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Update TZDB to ${{ env.LATEST_TZDB }}'
commit-message: 'Update time zone data to ${{ env.LATEST_TZDB }}'
committer: Stephen Colebourne (CI) <[email protected]>
author: Stephen Colebourne (CI) <[email protected]>
title: 'Update TZDB to ${{ env.LATEST_TZDB }}'
body: 'Updates TZDB data to ${{ env.LATEST_TZDB }}'
title: 'Update time zone data to ${{ env.LATEST_TZDB }}'
body: 'Update time zone data to ${{ env.LATEST_TZDB }}'
assignees: jodastephen
labels: TZDB
branch: bot/update-tzdb
6 changes: 3 additions & 3 deletions src/main/java/org/joda/time/tz/ZoneInfoCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
import org.joda.time.format.ISODateTimeFormat;

/**
* Compiles IANA ZoneInfo database files into binary files for each time zone
* Compiles standard format time zone data files into binary files for each time zone
* in the database. {@link DateTimeZoneBuilder} is used to construct and encode
* compiled data files. {@link ZoneInfoProvider} loads the encoded files and
* converts them back into {@link DateTimeZone} objects.
* <p>
* Although this tool is similar to zic, the binary formats are not
* compatible. The latest IANA time zone database files may be obtained
* <a href="https://www.iana.org/time-zones">here</a>.
* compatible. The latest time zone database files may be obtained
* <a href="https://github.com/JodaOrg/global-tz/releases">here</a>.
* <p>
* ZoneInfoCompiler is mutable and not thread-safe, although the main method
* may be safely invoked by multiple threads.
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/joda/time/tz/src/Readme.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
The data files in this directory were obtained from the public IANA time zone database,
https://www.iana.org/time-zones, see pom.xml for the version.
The data files in this directory were obtained from global-tz,
https://github.com/JodaOrg/global-tz, see pom.xml for the version.
These files are declared to be in the Public Domain.
5 changes: 3 additions & 2 deletions src/site/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ calculations. It already provides out-of-the-box features, such as support for o
date formats, which are difficult to replicate with the JDK.
* <b>Up-to-date Time Zone calculations</b>.
The <a href="timezones.html">time zone implementation</a> is based on
the public <a href="https://www.iana.org/time-zones">tz database</a>, which is
updated several times a year. New Joda-Time releases incorporate all changes
<a href="https://github.com/JodaOrg/global-tz">global-tz</a>, which is a fork of the
original data provided by IANA.
It is updated several times a year. New Joda-Time releases incorporate all changes
made to this database. Should the changes be needed earlier,
<a href="tz_update.html">manually updating the zone data</a> is easy.
* <b>Calendar support</b>.
Expand Down
10 changes: 6 additions & 4 deletions src/site/xdoc/timezones.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

<section name="Available Time Zones">
<p>
Time zone data is provided by the public IANA <a href="https://www.iana.org/time-zones">time zone database</a>.
The following table shows all the time zones supported by Joda-Time, using version 2018g
of the database.
It is also possible to update to a <a href="tz_update.html">later version of the database</a>.
Time zone data is provided by <a href="https://github.com/JodaOrg/global-tz">globa-tz</a>
which is derived from the standard IANA <a href="https://www.iana.org/time-zones">tz database</a>,
but global-tz reinstates data that was inappropriately removed.
The following table shows the time zones supported by Joda-Time, using version 2018g of the database.
Note that Joda-Time's time zone database is more up to date than 2018g!
See this page to <a href="tz_update.html">update the time zone data</a>.
This table can be rebuilt by running <code>org.joda.example.time.TimeZoneTable</code>.
</p>
<p>
Expand Down
10 changes: 5 additions & 5 deletions src/site/xdoc/tz_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<p>
Time zones are a concept driven by the political situation in each country around the world.
As such, they change frequently, and often at short notice.
In order to manage this, Joda-Time uses the internationally recognised
<a href="https://www.iana.org/time-zones">tz database</a>, which is also used
in most operating systems and the JDK itself.
In order to manage this, Joda-Time uses <a href="https://github.com/JodaOrg/global-tz">global-tz</a>
which is derived from the standard IANA <a ref="https://www.iana.org/time-zones">tz database</a>.
This is the same core data set used in most operating systems and the JDK itself.
</p>
<p>
Using JDK time zone data is a problem however, as the zones are only updated when the
Expand All @@ -30,8 +30,8 @@ that you can update the raw data and recompile the jar at any time.
<section name="Updating the time zone data">
<p>
Firstly, download the latest version of the data files from
<a href="https://www.iana.org/time-zones">tz database</a>.
Ensure you select the "Data" download which comes as a tar.gz.
<a href="https://github.com/JodaOrg/global-tz/releases">global-tz</a>.
Ensure you select the "tzdata" download which comes as a tar.gz.
</p>
<p>
Secondly, you need a <a href="download.html">source code download</a> of Joda-Time.
Expand Down
4 changes: 2 additions & 2 deletions src/site/xdoc/userguide.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ DateTimeZone zoneUTC = DateTimeZone.forOffsetHours(hours);
</source>
</p>
<p>
The time zone implementation is based on data provided by the public
IANA <a href="https://www.iana.org/time-zones">time zone database</a>.
The time zone implementation is based on data provided by
<a href="https://github.com/JodaOrg/global-tz">global-tz</a>.
A full list of time zone ids can be found <a href="timezones.html">here</a>
</p>
<p>
Expand Down

0 comments on commit b654344

Please sign in to comment.