]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(tz_compute): If time to switch to DST is later in the year switch back in the next...
authorUlrich Drepper <drepper@redhat.com>
Sun, 25 Oct 1998 22:10:12 +0000 (22:10 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 25 Oct 1998 22:10:12 +0000 (22:10 +0000)
time/tzset.c

index c35017c960b3502f45f7035b5763ca8eb9c21988..0621cd9af7da813a2116d31750e47dff63e27d51 100644 (file)
@@ -517,9 +517,20 @@ tz_compute (timer, tm)
      time_t timer;
      const struct tm *tm;
 {
-  if (! compute_change (&tz_rules[0], 1900 + tm->tm_year) ||
-      ! compute_change (&tz_rules[1], 1900 + tm->tm_year))
+  if (! compute_change (&tz_rules[0], 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.  */
+  if (tz_rules[0].change < tz_rules[1].change)
+    {
+      if (! compute_change (&tz_rules[1], 1900 + tm->tm_year))
+       return 0;
+    }
+  else
+    {
+      if (! 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;