- for (i = 0; i < num_types; ++i)
- __tzname[types[i].isdst] = __tzstring (&zone_names[types[i].idx]);
+ for (i = num_transitions; i > 0; )
+ {
+ int type = type_idxs[--i];
+ int dst = types[type].isdst;
+
+ if (__tzname[dst] == NULL)
+ {
+ int idx = types[type].idx;
+
+ __tzname[dst] = __tzstring (&zone_names[idx]);
+
+ if (__tzname[1 - dst] != NULL)
+ break;
+ }
+ }
+ if (__tzname[0] == NULL)
+ {
+ /* This should only happen if there are no transition rules.
+ In this case there should be only one single type. */
+ assert (num_types == 1);
+ __tzname[0] = __tzstring (zone_names);
+ }