[tpm] TZ code to hour offset conversion ideas?

Richard Dice rdice at pobox.com
Wed Oct 8 17:22:12 PDT 2008

Hi Madi,

There is data in a file, and you need the data in the file in order to give
you some information you need to work with.

Obviously, you need an extraction routine to get the data in the file,
assuming it is even remotely complicated.  (If it's simple you could use
split or unpack or regexen or something like that.)

You have two options:

   1. find the extraction routine that someone else created to get at the
   data (probably a CPAN module if a CPAN module exists for the data you want)
   2. create your own extraction routine (which will probably just be a
   complicated composition of split or unpack or regexen, looping through lines
   in the file and building up various data structures for manipulation... or,
   if the data is really-gnarly-but-regular then maybe you'd use a formal
   parsing technique, like Parse::RecDescent)

Option 1 is a research project for you to find what you need, if indeed it
exists.  Option 2 is elbow grease.  Either way, please let us know how
things work out.

(But you already enumerated options 1 and 2 in your own email, more or
less.  So... what exactly are you asking us for?)

 - Richard

On Wed, Oct 8, 2008 at 7:28 PM, Madison Kelly <linux at alteeve.com> wrote:

> Hi all,
>  I want to create a simple ... "library"? ... to provide data for a simple
> method do say:
> my $offset=&get_tz_offset("est", "1998-06-15");
>  I've got the TZ data from: http://www.twinsun.com/tz/tz-link.htm
>  It would need to be parsed though, and this I am hoping I can avoid by
> downloading an existing parser (I am not too concerned how this parser
> actually dumps data, I can hack that up). I just need something like: "For
> TZ X in date Y, the offset is Z".
>  I am not sure if I will need the geographic data, as I am not trying to
> determine what the TZ is, that's given to me. I just need the offset for the
> given date.
> Any suggestions? Should I start hacking up a parser myself? Do I ask too
> many questions? :)
> Madi
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20081008/6b8e2079/attachment.html>

More information about the toronto-pm mailing list