Thread View: gnu.utils.bug
1 messages
1 total messages
Started by Jason Merrill
Sat, 07 Nov 1992 03:45
Bug & fix in shellutils-1.8 date on old machines
Author: Jason Merrill
Date: Sat, 07 Nov 1992 03:45
Date: Sat, 07 Nov 1992 03:45
77 lines
3209 bytes
3209 bytes
date -u does not work on some antiquated hosts that don't support setting
the time zone via the TZ environment variable. One such is the Sequent
Symmetry (Dynix 3.1.2).
>From looking at two other hosts which do support TZ (Ultrix 4.2, SunOS
4.1.2), it would seem that if TZ support is there, so is the function
tzset. If this is incorrect, another check will have to be substituted.
Here are the unified diffs:
diff -ur tmp/shellutils-1.8/ChangeLog shellutils-1.8/ChangeLog
--- tmp/shellutils-1.8/ChangeLog Wed Oct 28 12:27:01 1992
+++ shellutils-1.8/ChangeLog Fri Nov 6 19:29:15 1992
@@ -1,3 +1,17 @@
+Fri Nov 6 19:24:19 1992 Jason Merrill (jason@jarthur.claremont.edu)
+
+ * Added support in date(1) for hosts that don't support setting the
+ timezone with the environment variable TZ:
+
+ * configure.in: Added check for tzset(3) -- is this always present
+ if the host supports TZ?
+
+ * strftime.c (zone_name): If no tzset, check env manually and
+ return "GMT" if appropriate.
+
+ * date.c (show_date): If no tzset, check env manually and use
+ gmtime(3) if appropriate.
+
Wed Oct 28 14:16:48 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
* Version 1.8.
diff -ur tmp/shellutils-1.8/configure.in shellutils-1.8/configure.in
--- tmp/shellutils-1.8/configure.in Thu Oct 1 17:56:22 1992
+++ shellutils-1.8/configure.in Fri Nov 6 18:37:59 1992
@@ -82,6 +82,7 @@
AC_ALLOCA
AC_STRUCT_TM
AC_TIMEZONE
+AC_HAVE_FUNCS(tzset)
AC_XENIX_DIR
echo checking for libinet
# Needed on ISC for syslog.
diff -ur tmp/shellutils-1.8/lib/strftime.c shellutils-1.8/lib/strftime.c
--- tmp/shellutils-1.8/lib/strftime.c Fri Jul 24 14:24:55 1992
+++ shellutils-1.8/lib/strftime.c Fri Nov 6 19:34:52 1992
@@ -216,6 +216,12 @@
struct timeval tv;
struct timezone tz;
+#ifndef HAVE_TZSET
+ extern char *getenv();
+ char *tzenv = getenv ("TZ");
+ if (tzenv && *tzenv == '\0') /* TZ= */
+ return "GMT";
+#endif
gettimeofday (&tv, &tz);
return timezone (tz.tz_minuteswest, tp->tm_isdst);
}
diff -ur tmp/shellutils-1.8/src/date.c shellutils-1.8/src/date.c
--- tmp/shellutils-1.8/src/date.c Mon May 11 21:09:07 1992
+++ shellutils-1.8/src/date.c Fri Nov 6 19:33:28 1992
@@ -156,7 +156,14 @@
char *out = NULL;
size_t out_length = 0;
- tm = localtime (&when);
+#ifndef HAVE_TZSET
+ /* Note: the code in strftime.c:zone_name() to determine the time zone
+ requires that TZ_UCT be "TZ=" */
+ if (!strcmp (getenv ("TZ"), TZ_UCT+3))
+ tm = gmtime (&when);
+ else
+#endif /* HAVE_TZSET */
+ tm = localtime (&when);
if (format == NULL)
/* Print the date in the default format. Vanilla ANSI C strftime
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads