[tz] tz abbreviations / zdump for programmers

Steffen Daode Nurpmeso sdaoden at googlemail.com
Mon Jun 4 15:36:34 UTC 2012

Boruch Baum <boruch_baum at gmx.com> wrote:

 |My current plan is:
 |tzinfo    {
 |    time_t start         /// seconds from epoch
 |    int    utc_offset    /// in minutes, or maybe seconds.
 |    char   is_dst        /// 0/1

I would suggest to you using a different field for that, which, if
not 0, would implicit mean "is daylight saving".
We have a 'save_secs' field instead, meaning the time to save in
seconds (we only use seconds, also in our utf_offset, which thus
refers to the unadjusted offset).  Sometimes nice.

 |    char[] tz_abbrev     ///
 |    const char end_mark  /// '\0'

Ah, and we have a hashmap of all possible zone abbreviations, and
only store the index of it in our "RuleDat".  Less compact, but
one can store the string somewhere nearer as necessary.
(Due to filename length issues and data compactness we've used
a single binary database approach.)

Just my one cent.

Forza Figa!

More information about the tz mailing list