home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v7 / text0009.txt < prev    next >
Encoding:
Internet Message Format  |  1987-06-30  |  2.9 KB

  1. From: seismo!elsie!ado (Arthur Olson)
  2. Date: Mon, 29 Sep 86 22:46:41 EDT
  3.  
  4. A few words regarding the "P.55" time zone proposal.
  5.  
  6. One thing it lacks is a way of determining the "time zone abbreviation"
  7. ("EST" or "EDT" or "EWT", for example) to be used with a particular combination
  8. of time and time zone.  One approach is to declare a global variable such as
  9.     char *    tz_abbr;
  10. and have "localtime" set it to point to the abbreviation for the converted time.
  11. Alternately, some folks have suggested adding either a character pointer or a
  12. character array to the "struct tm" that "localtime" returns as a way of
  13. recording the abbreviation.  The approach used isn't too important;
  14. standardizing the approach is.  (Avoiding changes to the "struct tm" structure
  15. would be desirable if there are applications that have stored such structures
  16. in files.  I don't know of--and can't imagine--applications that do so.)
  17.  
  18. If the standard *does* end up telling how a caller of localtime can learn the
  19. abbreviation for the converted time, then a change may be needed in the
  20. passage reading
  21.  
  22. > When called with a null string (p!=0 && *p=='\0'), settz
  23. > shall select no conversion for localtime, making localtime()
  24. > and gmtime() equivalent and ctime() and asctime(gmtime())
  25. > equivalent.
  26.  
  27. If, for example, "localtime" sets "tz_abbr" as a side effect, but "gmtime"
  28. doesn't, then calling "localtime" and calling "gmtime" can never be equivalent.
  29.  
  30. It may be simplest to just leave the settz("") case out of the standard
  31. entirely--any application programmer who's interested in getting GMT can
  32. just call gmtime() directly.  (The settz("") case is actually a bone to throw
  33. to speedsters who don't want "ls" to get time conversion information from
  34. disk; while this has some value, the value may well be too small to warrant
  35. standardization.)  But having settz((char *) 0) set things for local time
  36. (regardless, for example, of the state of the environment variable "TZ")
  37. provides a capability that's important to programs such as uucp;
  38. the behavior of settz((char *) 0) *should*, I believe, be documented.
  39.  
  40. Concretely:  I'd suggest this shortening of section 4.5.3.2:
  41.     4.5.3.2    Description
  42.     The settz() function determines the conversion from GMT
  43.     of the local times returned by localtime() and ctime().
  44.     When called with a null pointer argument (p==0), settz
  45.     shall select the appropriate local time conversion for the
  46.     location of the host machine on which the call is executed.
  47.     When called with a non-null pointer argument (p!=0),
  48.     settz may set the conversion according to that string...
  49.  
  50. And, perhaps, an addition along these lines to 4.5.4.3 (or wherever):
  51.     As a side effect, both ctime and localtime set the global character
  52.     pointer tz_abbr to point to the time zone abbreviation for the
  53.     converted time and time zone.
  54. --
  55.     UUCP: ..decvax!seismo!elsie!ado   ARPA: elsie!ado@seismo.ARPA
  56.     DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.
  57.  
  58. Volume-Number: Volume 7, Number 10
  59.  
  60.