home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / utils / bug / 2008 < prev    next >
Encoding:
Text File  |  1992-11-08  |  3.0 KB  |  91 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jarthur.claremont.edu!jason
  3. From: jason@jarthur.claremont.edu (Jason Merrill)
  4. Subject: Bug & fix in shellutils-1.8 date on old machines
  5. Message-ID: <1992Nov7.034519.11267@muddcs.claremont.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: Harvey Mudd College, Claremont, CA 91711
  8. Distribution: gnu
  9. Date: Sat, 7 Nov 1992 03:45:19 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 78
  12.  
  13. date -u does not work on some antiquated hosts that don't support setting
  14. the time zone via the TZ environment variable.  One such is the Sequent
  15. Symmetry (Dynix 3.1.2).
  16.  
  17. >From looking at two other hosts which do support TZ (Ultrix 4.2, SunOS
  18. 4.1.2), it would seem that if TZ support is there, so is the function
  19. tzset.  If this is incorrect, another check will have to be substituted.
  20.  
  21. Here are the unified diffs:
  22.  
  23. diff -ur tmp/shellutils-1.8/ChangeLog shellutils-1.8/ChangeLog
  24. --- tmp/shellutils-1.8/ChangeLog    Wed Oct 28 12:27:01 1992
  25. +++ shellutils-1.8/ChangeLog    Fri Nov  6 19:29:15 1992
  26. @@ -1,3 +1,17 @@
  27. +Fri Nov  6 19:24:19 1992  Jason Merrill  (jason@jarthur.claremont.edu)
  28. +
  29. +    * Added support in date(1) for hosts that don't support setting the
  30. +    timezone with the environment variable TZ:
  31. +
  32. +    * configure.in: Added check for tzset(3) -- is this always present
  33. +    if the host supports TZ?
  34. +
  35. +    * strftime.c (zone_name): If no tzset, check env manually and
  36. +    return "GMT" if appropriate.
  37. +
  38. +    * date.c (show_date): If no tzset, check env manually and use
  39. +    gmtime(3) if appropriate.
  40. +
  41.  Wed Oct 28 14:16:48 1992  David J. MacKenzie  (djm@goldman.gnu.ai.mit.edu)
  42.  
  43.      * Version 1.8.
  44. diff -ur tmp/shellutils-1.8/configure.in shellutils-1.8/configure.in
  45. --- tmp/shellutils-1.8/configure.in    Thu Oct  1 17:56:22 1992
  46. +++ shellutils-1.8/configure.in    Fri Nov  6 18:37:59 1992
  47. @@ -82,6 +82,7 @@
  48.  AC_ALLOCA
  49.  AC_STRUCT_TM
  50.  AC_TIMEZONE
  51. +AC_HAVE_FUNCS(tzset)
  52.  AC_XENIX_DIR
  53.  echo checking for libinet
  54.  # Needed on ISC for syslog.
  55. diff -ur tmp/shellutils-1.8/lib/strftime.c shellutils-1.8/lib/strftime.c
  56. --- tmp/shellutils-1.8/lib/strftime.c    Fri Jul 24 14:24:55 1992
  57. +++ shellutils-1.8/lib/strftime.c    Fri Nov  6 19:34:52 1992
  58. @@ -216,6 +216,12 @@
  59.    struct timeval tv;
  60.    struct timezone tz;
  61.  
  62. +#ifndef HAVE_TZSET
  63. +  extern char *getenv();
  64. +  char *tzenv = getenv ("TZ");
  65. +  if (tzenv && *tzenv == '\0')    /* TZ= */
  66. +    return "GMT";
  67. +#endif  
  68.    gettimeofday (&tv, &tz);
  69.    return timezone (tz.tz_minuteswest, tp->tm_isdst);
  70.  }
  71. diff -ur tmp/shellutils-1.8/src/date.c shellutils-1.8/src/date.c
  72. --- tmp/shellutils-1.8/src/date.c    Mon May 11 21:09:07 1992
  73. +++ shellutils-1.8/src/date.c    Fri Nov  6 19:33:28 1992
  74. @@ -156,7 +156,14 @@
  75.    char *out = NULL;
  76.    size_t out_length = 0;
  77.  
  78. -  tm = localtime (&when);
  79. +#ifndef HAVE_TZSET
  80. +  /* Note: the code in strftime.c:zone_name() to determine the time zone
  81. +     requires that TZ_UCT be "TZ=" */
  82. +  if (!strcmp (getenv ("TZ"), TZ_UCT+3))
  83. +    tm = gmtime (&when);
  84. +  else
  85. +#endif /* HAVE_TZSET */
  86. +    tm = localtime (&when);
  87.  
  88.    if (format == NULL)
  89.      /* Print the date in the default format.  Vanilla ANSI C strftime
  90.  
  91.