[tz] Beginner's help request

Tim Parenti tim at timtimeonline.com
Sun Oct 15 00:22:02 UTC 2017


Just a short message to help you get quickly started along the right path.

A guide to interpreting the source data can be found in tz-how-to.html; I'm
not sure offhand whether that's in the particular tar file you have, but a
development version is available from https://github.com/eggert/tz/b

For your idea of a text-only table of already-parsed data, you may consider
the zdump utility that is packaged in the distribution. For your example,
to obtain the offsets for Australia/Hobart for 2017 only:

$ zdump -vc 2017,2018 Australia/Hobart
Australia/Hobart  -9223372036854775808 = NULL
Australia/Hobart  -9223372036854689408 = NULL
Australia/Hobart  Sat Apr  1 15:59:59 2017 UTC = Sun Apr  2 02:59:59 2017
AEDT isdst=1 gmtoff=39600
Australia/Hobart  Sat Apr  1 16:00:00 2017 UTC = Sun Apr  2 02:00:00 2017
AEST isdst=0 gmtoff=36000
Australia/Hobart  Sat Sep 30 15:59:59 2017 UTC = Sun Oct  1 01:59:59 2017
AEST isdst=0 gmtoff=36000
Australia/Hobart  Sat Sep 30 16:00:00 2017 UTC = Sun Oct  1 03:00:00 2017
AEDT isdst=1 gmtoff=39600
Australia/Hobart  9223372036854689407 = NULL
Australia/Hobart  9223372036854775807 = NULL

Tim Parenti
sent from my Android phone

On 14 Oct 2017 19:15, "Daniel Ford" <dfnojunk at gmail.com> wrote:

> I'm looking to develop a 'world clock' that could be sold to anyone (with
> Internet access via a Wi-Fi AP) anywhere in the world, that will display
> their local time, taking into account DST if/when applicable.
> Given that DST 'rules' can change at the whim of governments, my firmware
> will need to annually look up 'current' DST rules from the web.  After much
> searching, it seems that your TZ Database is the best supported such
> reference for time zone rules.  But I'm having great difficulty working out
> how I might access its mine of information...
> (I'll understand if you don't have time to help out a beginner, and maybe
> then you could refer me to a help site for TZ database applications.)
> I'm a hardware engineer with some programming experience, particularly
> assembler (various MCUs) and some C, but little or no experience in other
> languages.  I'm developing this clock on an Arduino-like platform (NodeMCU,
> which has in-built Wi-Fi).  My development tools run on a Win7Pro64 PC.
> The tools that you kindly provide for your database appear to be geared
> primarily towards Linux/Unix platforms, and I have no idea how I might
> convert them for a NodeMCU!  I'm looking for some 'simple' way to access
> the
> desired TZ/DST information, preferably using simple string searches.
> For my application, all I'm interested in are the *current* rules.  The
> wealth of history in your db is undoubtedly of interest to many, but for me
> is just 'clutter' to be searched through.  But writing a program to find
> those rules for a particular locality has me stumped right now.  I can't
> expect my dumb users to know a letter code for their time-zone/DST-rules,
> so
> all I'm expecting them to select from program-generated lists are: (1)
> their
> world region (Europe, Asia, Australasia, etc), and (2) the name of a major
> city in their time-zone with the same DST rules they follow.
> Let's take a concrete example: say my user has nominated 'Australasia' and
> 'Hobart'.  So I look in your Australasia file and do a (manual at this
> stage) search for 'Hobart', but find only one reference to it (other than
> in
> comments).  The jumble of numbers and letters there do not (clearly) tell
> me
> when DTS starts or ends.  So how could I possibly write some code to find
> out that required information??
> I've looked through the TZ_database-2017b.tar file for some sort of
> 'how-to'
> explanation of what all the file contents mean and how to programmatically
> search for a specific TZ, but have so far found nothing.
> Ideally, what I'd like to see is a text-only table of just current TZ/DST
> rules for each region/locality (they could all fit into a single file with
> all the historical data and comments removed), perhaps in the clear form
> used by Jack Christensen in his excellent Arduino Timezone library
> examples,
> such as...
> // Australia Eastern Time Zone (Sydney, Melbourne, Hobart)
> TimeChangeRule aEDT = {"AEDT", First, Sun, Oct, 2, 660};
> TimeChangeRule aEST = {"AEST", First, Sun, Apr, 3, 600};
> TimezoneExt ausET("NSW, Vic, Tas", aEDT, aEST);
> // Australia Eastern Time Zone (Brisbane)
> TimezoneExt QldT("Queensland", aEST, aEST);  // no DST in Qld!
> ... which clearly tells me in a program-searchable way that in the main
> eastern states DST starts on the first Sunday in October at 2am, becoming
> UTC offset +11 hours (660 minutes), and ends on the first Sunday in April
> at
> 3am, reverting to UTC offset +10 hours.  Couldn't be simpler!
> Any help in using the TZ database will be much appreciated (and
> acknowledged
> in my source code).
> Regards,
> Daniel
> ---------------
> Daniel Ford (Gerroa, Australia)
> "My loathings are simple: stupidity, oppression, crime, cruelty, soft
> music." - Vladimir Nabokov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20171014/e3ad73cf/attachment.htm>

More information about the tz mailing list