Handling %s format strings
I'm the developer of TZInfo (http://tzinfo.rubyforge.org/), a Ruby library that uses the tz database (thanks for the link on twinsun.com by the way). I'm running into an issue where I'm unable to determine what the zone name is in cases where %s is used as the entire format string. This happens in the following zones: Africa/Accra Africa/Freetown Europe/Amsterdam Europe/Gibraltar Europe/London Europe/Moscow Take Africa/Accra as an example. Starting from 1918, this zone uses the Ghana rules with a %s format string. The Ghana rules only start to be defined from 1936. Europe/London contains two examples of the problem. The first happens similarly to Africa/Accra. LMT ends in 1847. The next period has a format of %s, but the first rule in GB-Eire doesn't start until 1916. The second example is with the period starting in 1971. Again this has a format of %s but a first rule starting in 1972. Basically, my problem is in dealing with the gap until the first rule/transition within a period of the zones. How should I be interpreting the data in these cases? Thanks, Philip Ross
Philip Ross wrote:
I'm running into an issue where I'm unable to determine what the zone name is in cases where %s is used as the entire format string. This happens in the following zones:
After some further checking, I've noticed the same problem also applies when %s is used as part of the string (e.g. P%sT in America/Los_Angeles). For America/Los_Angeles, the switch from LMT happens in 1883, but the first rule is not until 1918. Is there a standard for these types of zones in the absence of a rule (e.g. S/D)? Thanks, Phil
Philip Ross <phil.ross@gmail.com> writes:
Take Africa/Accra as an example. Starting from 1918, this zone uses the Ghana rules with a %s format string. The Ghana rules only start to be defined from 1936.
In this case, it's assumed that you start off in standard time, and that you take the rule's first abbreviation that applies to standard time. For your example, that's "GMT". If you inspect the 'zic' source code you should see that rule in action. No doubt this should be documented....
Paul Eggert wrote:
Philip Ross <phil.ross@gmail.com> writes:
Take Africa/Accra as an example. Starting from 1918, this zone uses the Ghana rules with a %s format string. The Ghana rules only start to be defined from 1936.
In this case, it's assumed that you start off in standard time, and that you take the rule's first abbreviation that applies to standard time. For your example, that's "GMT". If you inspect the 'zic' source code you should see that rule in action.
No doubt this should be documented....
I'd read the zic man page, but hadn't got round to checking the source in any detail. I'll have a go at implementing this. Thanks, Phil
participants (2)
-
Paul Eggert -
Philip Ross