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

  1. From: utah-cs!hplabs!hpfcla!hpfclj!hpfcdg!rgt (Ron Tolley)
  2. Date: Wed, 10 Dec 86 18:51:58 est
  3.  
  4. The HP proposal  boils down to five  changes to the RFC.001  Timezone
  5. Interface  by Robert Elz.  I have  listed  these in order of  importance
  6. with  exception  of the  first  (which  is  really  just a  change  to a
  7. comment).  As it turns out they are also in the order  that  they  would
  8. appear in RFC.001.
  9.  
  10. [ RFC.001 has been superseded by P.55, which I reposted recently.  -mod ]
  11.  
  12. <(1) Replace (if it makes any difference) the paragraph>
  13.  
  14. So, I'm going to propose something that could be inserted into
  15. P1003 (with the obvious extra definitions that I'm going to
  16. leave out on the assumption that everyone knows what they are,
  17. like the definition of the struct "tm").
  18.  
  19. <with the paragraph>
  20.  
  21. So, I'm going to propose something that could be inserted into
  22. P1003 (with the obvious extra definitions that I'm going to
  23. leave out on the assumption that everyone knows what they are.)
  24.  
  25. <(2) Replace the paragraph>
  26.  
  27. Implementations shall provide the following functions:
  28.  
  29.     struct tm *gmtime(t) time_t *t;
  30.     struct tm *localtime(t) time_t *t;
  31.     int settz(p) char *p;
  32.     char *asctime(tp) struct tm *tp;
  33.     char *ctime(t) time_t *t;
  34.  
  35. <with the following paragraphs>
  36.  
  37. The "tm" structure shall be defined as:
  38.  
  39.     struct tm {
  40.         int tm_sec;    /\(** seconds (0 - 59) \(**/
  41.         int tm_min;    /\(** minutes (0 - 59) \(**/
  42.         int tm_hour;    /\(** hours (0 - 23) \(**/
  43.         int tm_mday;    /\(** day of month (1 - 31) \(**/
  44.         int tm_mon;    /\(** month of year (0 - 11) \(**/
  45.         int tm_year;    /\(** year \- 1900 \(**/
  46.         int tm_wday;    /\(** day of week (Sunday = 0) \(**/
  47.         int tm_yday;    /\(** day of year (0 - 365) \(**/
  48.         int tm_isdst;    /\(** is DST in effect? \(**/
  49.         long tm_tzadj;    /\(** time zone adjustment \(**/
  50.         char *tm_tnptr;    /\(** points to time zone name \(**/
  51.     };
  52.  
  53. where  tm_isdst is non-zero if a time zone  adjustment  such as Daylight
  54. Savings Time is in effect,  tm_tzadj is the  difference  between GMT and
  55. local  time  expressed  in  seconds,  and  tm_tnptr  points  to a string
  56. containing the time zone abbreviation.
  57.  
  58. The tm_isdst,  tm_tzadj, and tm_tnptr members of the tm structure may be
  59. viewed as equivalents to the daylight,  timezone, and tzname[]  external
  60. variables  however  their  values  track  those  in the  rest  of the tm
  61. structure.
  62.  
  63. Implementations shall provide the following functions:
  64.  
  65.     struct tm *gmtime(t) time_t *t;
  66.     struct tm *localtime(t) time_t *t;
  67.     int settz(p) char *p;
  68.     char *asctime(tp) struct tm *tp;
  69.     char *ctime(t) time_t *t;
  70.     int strftime (p, n, f, tp) char *p, int n, char *f, struct tm *tp;
  71.     int strctime (p, n, f, t) char *p, int n, char *f, time_t *t;
  72.     time_t mktime (tp) struct tm *tp;
  73.  
  74. <(3) Add after the paragraph describing ctime the following paragraphs>
  75.  
  76. strftime:  supports  formatted  output of date and time,  according to a
  77. user-supplied  format string.  Locale-specific  values such as month and
  78. weekday names are provided  according to the currently  defined  locale.
  79. (The  method  of  setting  locale  will  be  addressed   elsewhere.  The
  80. setlocale  or  nl_init   routines  are   currently   available  in  some
  81. implementations.)  Strftime  limits the length of the return string p to
  82. be  no  greater  than  n  characters  (including  the  terminating  null
  83. character).  The  actual  number  of  characters   (excluding  the  null
  84. character)  included in p is returned by each  successful  call.  Unlike
  85. asctime, no newline is automatically appended to the formatted string.
  86.  
  87. strctime:  also supports formatting but takes time_t *t as an argument.
  88.  
  89. format:  uses field  descriptors  similar to those in the first argument
  90. to printf(3S).  Numeric  output fields are of fixed size (zero padded if
  91. necessary).  All other  characters  are  copied  to the  output  without
  92. change.  Field descriptors are expanded as follows:
  93.  
  94.     %a is replaced by the abbreviated weekday name
  95.  
  96.     %A is replaced by the full weekday name
  97.  
  98.     %b is replaced by the abbreviated month name
  99.  
  100.     %B is replaced by the full month name
  101.  
  102.     %c is replaced by the appropriate date and time representation
  103.  
  104.     %d is replaced by the day of the month as a decimal number (01
  105.        to 31)
  106.  
  107.     %H is replaced by the hour (24-hour clock) as a decimal number
  108.        (00 to 23)
  109.  
  110.     %I is replaced by the hour (12-hour clock) as a decimal number
  111.        (01 to 12)
  112.  
  113.     %j is replaced by the day of the year as a decimal number (001
  114.        to 366)
  115.  
  116.     %m is replaced by the month as a decimal number (01 to 12)
  117.  
  118.     %M is replaced by the minute as a decimal number (00 to 59)
  119.  
  120.     %n is replaced by a new-line character
  121.  
  122.     %p is replaced by the equivalent of AM or PM
  123.  
  124.     %r is replaced by the appropriate (12-hour clock) time
  125.        representation
  126.  
  127.     %S is replaced by seconds as a decimal number (00 to 59)
  128.  
  129.     %t is replaced by a tab character
  130.  
  131.     %U is replaced by the week number of the year with Sunday as the
  132.        first day of the week (00 to 52)
  133.  
  134.     %V is replaced by the week number of the year with Monday as the
  135.        first day of the week (00 to 52)
  136.  
  137.     %w is replaced by the weekday as a decimal number [0 (Sunday) to 6]
  138.  
  139.     %x is replaced by the appropriate date representation
  140.  
  141.     %X is replaced by the appropriate time representation
  142.  
  143.     %y is replaced by the year without century (00 to 99)
  144.  
  145.     %Y is replaced by the year with century
  146.  
  147.     %Z is replaced by the time zone name
  148.  
  149.     %% is replaced by %
  150.  
  151. <(4) Add the following paragraph after those mentioned in (3)>
  152.  
  153. mktime:  computes a long integer time value from a time value  contained
  154. in a "tm" structure.  The values of tm_wday and tm_yday are  overwritten
  155. during this computation.
  156.  
  157. <(5) Remove all references to settz().  Localtime will use the value of TZ
  158. to determine the what local time means.  If TZ is not set, then localtime
  159. will return a best guess at localtime.>
  160.  
  161. Ron Tolley
  162.  
  163. Volume-Number: Volume 8, Number 65
  164.  
  165.