aboutsummaryrefslogtreecommitdiff
path: root/time/tzfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'time/tzfile.c')
-rw-r--r--time/tzfile.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/time/tzfile.c b/time/tzfile.c
index eca09e2..a7753d2 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -281,15 +281,21 @@ __tzfile_read (const char *file)
compute_tzname_max (chars);
- rule_stdoff = rule_dstoff = 0;
- for (i = 0; i < num_transitions; ++i)
+ if (num_transitions == 0)
+ /* Use the first rule (which should also be the only one. */
+ rule_stdoff = rule_dstoff = types[0].offset;
+ else
{
- if (!rule_stdoff && !types[type_idxs[i]].isdst)
- rule_stdoff = types[type_idxs[i]].offset;
- if (!rule_dstoff && types[type_idxs[i]].isdst)
- rule_dstoff = types[type_idxs[i]].offset;
- if (rule_stdoff && rule_dstoff)
- break;
+ rule_stdoff = rule_dstoff = 0;
+ for (i = 0; i < num_transitions; ++i)
+ {
+ if (!rule_stdoff && !types[type_idxs[i]].isdst)
+ rule_stdoff = types[type_idxs[i]].offset;
+ if (!rule_dstoff && types[type_idxs[i]].isdst)
+ rule_dstoff = types[type_idxs[i]].offset;
+ if (rule_stdoff && rule_dstoff)
+ break;
+ }
}
__daylight = rule_stdoff != rule_dstoff;
@@ -381,6 +387,9 @@ __tzfile_default (const char *std, const char *dst,
__tzname[0] = (char *) std;
__tzname[1] = (char *) dst;
+ /* Set the timezone. */
+ __timezone = -types[0].offset;
+
compute_tzname_max (stdlen + dstlen);
}