about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-26 14:07:43 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-26 14:07:43 +0000
commit16d2c6a949e7594e42c06b20b8b6a33ed27ec4c5 (patch)
tree72f297016cb789d6ad2f108fc5cf89bdd0c9077b
parent079d719cfc0d401040e2e28e1159113ba1e56fa4 (diff)
downloadglibc-16d2c6a949e7594e42c06b20b8b6a33ed27ec4c5.tar.gz
glibc-16d2c6a949e7594e42c06b20b8b6a33ed27ec4c5.tar.xz
glibc-16d2c6a949e7594e42c06b20b8b6a33ed27ec4c5.zip
If time to switch to DST is later in the year switch back in the next
year.
-rw-r--r--time/tzset.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/time/tzset.c b/time/tzset.c
index 671c6103d5..970bbecd44 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -548,6 +548,13 @@ tz_compute (timer, tm)
   if (! compute_change (&tz_rules[0], 1900 + tm->tm_year) ||
       ! compute_change (&tz_rules[1], 1900 + tm->tm_year))
     return 0;
+  /* We have to distinguish between northern and southern hemisphere.
+     For the later the daylight saving time ends in the next year.
+     It is easier to detect this after first computing the time for the
+     wrong year since now we simply can compare the times to switch.  */
+  if (tz_rules[0].change > tz_rules[1].change
+      && ! compute_change (&tz_rules[1], 1900 + tm->tm_year + 1))
+    return 0;
 
   __daylight = tz_rules[0].offset != tz_rules[1].offset;
   __timezone = -tz_rules[0].offset;