about summary refs log tree commit diff
path: root/time/tzset.c
diff options
context:
space:
mode:
Diffstat (limited to 'time/tzset.c')
-rw-r--r--time/tzset.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/time/tzset.c b/time/tzset.c
index 2635155dd2..007997f541 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -90,18 +90,23 @@ DEFUN_VOID(__tzset)
       tz_rules[1].name != tz_rules[0].name)
     free((PTR) tz_rules[1].name);
 
-  tz = getenv("TZ");
+  /* Examine the TZ environment variable.  */
+  tz = getenv ("TZ");
 
-  if (tz != NULL && *tz == ':')
+  if (tz != NULL)
     {
-      __tzfile_read(tz + 1);
+      /* A leading colon means "implementation defined syntax".
+	 We ignore the colon and always use the same algorithm:
+	 try a data file, and if none exists parse the 1003.1 syntax.  */
+      if (*tz == ':')
+	++tz;
+
+      __tzfile_read (tz);
       if (__use_tzfile)
 	{
 	  __tzset_run = 1;
 	  return;
 	}
-      else
-	tz = NULL;
     }
 
   if (tz == NULL || *tz == '\0')