Bugs: Browse | Submit New | Admin

[#29620] tzinfo should use system-wide zoneinfo data

Date:
2012-07-27 13:12
Priority:
3
Submitted By:
Josef Stribny (jstribny)
Assigned To:
Philip Ross (psross)
Category:
Timezone Data
State:
Open
Summary:
tzinfo should use system-wide zoneinfo data

Detailed description
We would like to change the source of the data for the tzinfo gem to use zoneinfo that is already installed on the system
(as mentioned at https://bugzilla.redhat.com/show_bug.cgi?id=729763). I've noticed that you already started by creating
zoneinfo branch in svn and rewrited tzinfo to parse system binary zoneinfo data to load transitions and offsets.

We need to finish it so it would read everything from the system (not using the timezones and countries ruby index files
that comes with the gem).

Our idea is to use system zoneinfo data files by default and if there are not present, stay within the ruby data files
that comes with the gem. I have a time to do so, but we want to know that this will be approved and pushed to upstream.

Please let us know what you think.

Josef Stribny

Add A Comment: Notepad

Please login


Followup

Message
Date: 2012-11-26 19:13
Sender: Philip Ross

Hi Josef,

The source is still in SVN, but anonymous SVN access had been
switched off by the RubyForge admins due to it being used to
denial of service attack the server.

The svn://rubyforge.org/var/svn/tzinfo svnserve URL is now working
again (HTTP access remains switched off).

I have now implemented the split into separate tzinfo and tzinfo-data
gems. You'll find tzinfo at svn://rubyforge.org/var/svn/tzinfo/trunk
and tzinfo-data in svn://rubyforge.org/var/svn/tzinfo/tzinfo-data
/trunk.

There are a few more (fairly minor) changes I want to make before
releasing these changes. I hope to get these done over the next
few weeks.

Kind regards,

Phil
Date: 2012-11-26 10:27
Sender: Josef Stribny

Hi Philip,

I wanted to checkout the source from SVN, but it seems to be
no longer available. Are you moving it somewhere else?

I would like to look on the latest trunk version and see if
I can write a patch to finally separate it into two gems.

Sincerely
Josef
Date: 2012-08-23 08:55
Sender: Josef Stribny

Hi Phil,

thanks for working on this. When the tzinfo-data will be
ready as you like it, we will pack both. If you need any
help or further assistance, please let me know.

Best Regards
Josef
Date: 2012-08-20 22:10
Sender: Philip Ross

Hi Josef,

The TZInfo svn trunk now includes the code to support using zoneinfo
data files.

In my original zoneinfo branch and the subsequent code you added,
the Timezone and Country classes needed to be aware of whether
they were loading Ruby modules or zoneinfo files. I've decided
to restructure this a bit and have introduced a new DataSource
layer that the Timezone and Country classes use to obtain all
the (definition and index) data they need.

The code in svn currently defaults to using the Ruby modules
(RubyDataSource). Once I've got the data split out, this can
be changed to detect tzinfo-data and use the Ruby modules if
they are installed, otherwise fall back to zoneinfo files
(ZoneinfoDataSource).

If you want to try packaging what is in svn at the moment, then
you can patch the DataSource.create_default_data_source method
so that it returns ZoneinfoDataSource.new instead of
RubyDataSource.new and then omit the definitions and indexes
directories.

Regarding the 'standard offset one hour hack', I have included
a change to derive the offset along the lines of what we discussed
before.

I plan to take a look at the tzinfo-data split next and will
then aim to get a new release out that incorporates these
changes.

Kind regards,

Phil
Date: 2012-08-14 16:21
Sender: Josef Stribny

Hi Phil,

I have finished separating tzinfo into tzinfo [1] and
tzinfo-data [2]. TZInfo takes all data from zoneinfo if
possible. 'rake test' test only features that don't require
zoneinfo nor tzinfo-data. 'rake test-zoneinfo' test those
that do.

tzinfo-data contains Ruby modules, data folder and a parser
from tzinfo. I also downloaded the latest tz data (v2012e).
Tests for tzinfo-data now work only with tzinfo (is that an
issue?).

Please comment on this when you have time. Thank you.

Regards
Josef

[1] https://github.com/strzibny/tzinfo
[2] https://github.com/strzibny/tzinfo-data
Date: 2012-08-07 16:52
Sender: Josef Stribny

Hi Phil,

I rewrote TZInfo a bit to use zoneinfo if available. I tried
to stick with original files as much as possible so the
library would work pretty much the same.

Source is at GitHub: https://github.com/strzibny/tzinfo and
all the changes I made are mentioned in
https://github.com/strzibny/tzinfo/blob/master/tzinfo/README.

Please look at it and write us what you think. If you have
suggestions how to make it better or you find errors, please
feel free to let me know.

Thank you.

Best Regards
Josef
Date: 2012-08-01 06:38
Sender: Josef Stribny

Hi Phil,

thanks for your response. I think it's a good idea and I
should try to do it this way. I will finish the version that
doesn't require Ruby indexes and then we discuss splitting
the gem.

Best Regards
Josef
Date: 2012-07-30 23:02
Sender: Philip Ross

Hi Josef,

Yes, I'd be willing to accept a patch that allowed TZInfo to
use the system zoneinfo and index files.

The zoneinfo branch in SVN was created as an experiment for the
maintainers of the Debian tzinfo package (see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503591). Revision
207 is now being included as a patch in the ruby-tzinfo package
(from version 0.3.33-3). As you point out, this only deals with
the zoneinfo files and still requires the Ruby indexes. There
is also an issue with determining what the offset from standard
to daylight savings time is (revision 207 just assumes that this
will always be one hour).

Ideally, I'd like to have the Ruby data modules split out into
a separate tzinfo-data gem. The tzinfo gem would then just contain
the API and necessary code to interface with either zoneinfo
files or tzinfo-data. When tzinfo-data is not loaded (not in
the load path), TZInfo should use the zoneinfo files. When tzinfo-data
is in the load path then I think TZInfo should use the Ruby data
modules instead. Since zoneinfo files are usually present on
Unix-like systems, this would allow developers to override the
system data if they wanted to (e.g. for consistency between different
distributions). Fedora/Red Hat could then package just the core
tzinfo API, which would use the system zoneinfo files.

Kind regards,

Phil 

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item