about summary refs log tree commit diff
path: root/time
diff options
context:
space:
mode:
Diffstat (limited to 'time')
-rw-r--r--time/tzfile.c9
-rw-r--r--time/tzset.c18
2 files changed, 18 insertions, 9 deletions
diff --git a/time/tzfile.c b/time/tzfile.c
index c9becf3238..9fab857ecc 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -90,7 +90,6 @@ __tzfile_read (const char *file)
   struct tzhead tzhead;
   size_t chars;
   register size_t i;
-  struct ttinfo *info;
 
   __use_tzfile = 0;
 
@@ -415,13 +414,14 @@ find_transition (time_t timer)
 
 int
 __tzfile_compute (time_t timer, int use_localtime,
-		  long int *leap_correct, int *leap_hit)
+		  long int *leap_correct, int *leap_hit,
+		  int *isdst, long int *offset)
 {
+  struct ttinfo *info = find_transition (timer);
   register size_t i;
 
   if (use_localtime)
     {
-      struct ttinfo *info = find_transition (timer);
       __daylight = rule_stdoff != rule_dstoff;
       __timezone = -rule_stdoff;
       __tzname[1] = NULL;
@@ -434,6 +434,9 @@ __tzfile_compute (time_t timer, int use_localtime,
 	__tzname[1] = __tzname[0];
     }
 
+  *isdst = info->isdst;
+  *offset = info->offset;
+
   *leap_correct = 0L;
   *leap_hit = 0;
 
diff --git a/time/tzset.c b/time/tzset.c
index e42be39db8..251967e5c6 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -37,7 +37,8 @@ extern struct tm _tmbuf;
 extern int __use_tzfile;
 extern void __tzfile_read __P ((const char *file));
 extern int __tzfile_compute __P ((time_t timer, int use_localtime,
-				  long int *leap_correct, int *leap_hit));
+				  long int *leap_correct, int *leap_hit,
+				  int *isdst, long int *offset));
 extern void __tzfile_default __P ((const char *std, const char *dst,
 				   long int stdoff, long int dstoff));
 extern char *__tzstring __P ((const char *string));
@@ -594,6 +595,8 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
 {
   long int leap_correction;
   int leap_extra_secs;
+  int isdst;
+  long int offset;
 
   if (timer == NULL)
     {
@@ -612,7 +615,8 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
   if (__use_tzfile)
     {
       if (! __tzfile_compute (*timer, use_localtime,
-			      &leap_correction, &leap_extra_secs))
+			      &leap_correction, &leap_extra_secs,
+			      &isdst, &offset))
 	tp = NULL;
     }
   else
@@ -621,16 +625,18 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
 	tp = NULL;
       leap_correction = 0L;
       leap_extra_secs = 0;
+
+      isdst = (*timer >= tz_rules[0].change && *timer < tz_rules[1].change);
+      offset = tz_rules[isdst].offset;
     }
 
   if (tp)
     {
       if (use_localtime)
 	{
-	  tp->tm_isdst = (*timer >= tz_rules[0].change
-			  && *timer < tz_rules[1].change);
-	  tp->tm_zone = __tzname[tp->tm_isdst];
-	  tp->tm_gmtoff = tz_rules[tp->tm_isdst].offset;
+	  tp->tm_isdst = isdst;
+	  tp->tm_zone = __tzname[isdst];
+	  tp->tm_gmtoff = offset;
 	}
       else
 	{