home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / pd-localtime / patch < prev    next >
Encoding:
Internet Message Format  |  1987-04-13  |  8.2 KB

  1. Subject: v09i021:  Public Domain (Table Driven) ``localtime''
  2.  
  3. Submitted by: Arthur David Olson <ado@elsie.UUCP>
  4. Mod.sources: Volume 9, Issue 21
  5. Archive-name: pd-localtime/Patch1
  6.  
  7. System: pd-localtime
  8. Patch #: 1
  9. Priority: MEDIUM
  10.  
  11. Description:
  12.     This is patch #1 for the public domain localtime.
  13.  
  14.     It fixes the following problems (in decreasing order of severity):
  15.  
  16.     1) The "timezone" variable, defined when USG_COMPAT is defined
  17.        was being set to a value of the wrong sign (not compatible).
  18.  
  19.     2) asctime() did not guarantee zero filled 2 digit fields when
  20.        used with old versions of printf that cannot handle the "%.2d"
  21.        format specification.
  22.  
  23.     3) The STD_INSPIRED functions for converting "struct tm" values
  24.        to time_t's would fail when given a "struct tm" value that
  25.        was "illegal" (ie: not a possible output from localtime)
  26.        and which happen to occur just near the end of one of the
  27.        shorter months (the actual requirements are a little stricter
  28.        than this), or from timelocal or timeoff where the offset
  29.        moves the time from one month to another (where the earlier
  30.        month is one of the shorter ones).
  31.  
  32.     4) Missing rules for East Saskatchewan in Canada.
  33.  
  34.     5) Typos in the zic(8) manual page.
  35.  
  36. Fix:
  37.     From your newsreading program, say "| patch -d DIR" where DIR
  38.     is the directory where the pd-localtime distribution is saved.
  39.     Alternatively, change to that directory, and do "patch -d . <newsitem".
  40.     Recompile and re-install the library routines.  Recompile any
  41.     programs using the STD_INSPIRED functions.  There is no need to
  42.     recompile other programs unless the asctime output is incorrect.
  43.     (nb: Patchlevel.h is a new file).
  44.  
  45. Index: Patchlevel.h
  46. *** OLD/Patchlevel.h    Sun Apr 12 22:37:29 1987
  47. --- Patchlevel.h    Sun Apr 12 22:37:46 1987
  48. ***************
  49. *** 0
  50.  
  51. --- 1 -----
  52. + #define PATCHLEVEL 1
  53.  
  54. Index: asctime.c
  55. *** OLD/asctime.c    Sun Apr 12 22:28:21 1987
  56. --- asctime.c    Sun Apr 12 22:28:37 1987
  57. ***************
  58. *** 5,13
  59.   #include "stdio.h"
  60.   
  61.   #ifndef lint
  62.   #ifndef NOID
  63. ! static char    sccsid[] = "@(#)asctime.c    3.1";
  64.   #endif /* !NOID */
  65.   #endif /* !lint */
  66.   
  67.   #include "time.h"
  68.  
  69. --- 5,13 -----
  70.   #include "stdio.h"
  71.   
  72.   #ifndef lint
  73.   #ifndef NOID
  74. ! static char    sccsid[] = "@(#)asctime.c    3.2";
  75.   #endif /* !NOID */
  76.   #endif /* !lint */
  77.   
  78.   #include "time.h"
  79. ***************
  80. *** 33,41
  81.           "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  82.       };
  83.       static char    result[26];
  84.   
  85. !     (void) sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
  86.           wday_name[timeptr->tm_wday],
  87.           mon_name[timeptr->tm_mon],
  88.           timeptr->tm_mday, timeptr->tm_hour,
  89.           timeptr->tm_min, timeptr->tm_sec,
  90.  
  91. --- 33,41 -----
  92.           "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  93.       };
  94.       static char    result[26];
  95.   
  96. !     (void) sprintf(result, "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n",
  97.           wday_name[timeptr->tm_wday],
  98.           mon_name[timeptr->tm_mon],
  99.           timeptr->tm_mday, timeptr->tm_hour,
  100.           timeptr->tm_min, timeptr->tm_sec,
  101.  
  102. Index: localtime.c
  103. *** OLD/localtime.c    Sun Apr 12 22:28:22 1987
  104. --- localtime.c    Sun Apr 12 22:28:39 1987
  105. ***************
  106. *** 18,26
  107.   #endif /* !MAXPATHLEN */
  108.   
  109.   #ifndef lint
  110.   #ifndef NOID
  111. ! static char    sccsid[] = "@(#)localtime.c    3.1";
  112.   #endif /* !NOID */
  113.   #endif /* !lint */
  114.   
  115.   #ifndef TRUE
  116.  
  117. --- 18,26 -----
  118.   #endif /* !MAXPATHLEN */
  119.   
  120.   #ifndef lint
  121.   #ifndef NOID
  122. ! static char    sccsid[] = "@(#)localtime.c    3.2";
  123.   #endif /* !NOID */
  124.   #endif /* !lint */
  125.   
  126.   #ifndef TRUE
  127. ***************
  128. *** 178,186
  129.       ** Set tzname elements to initial values.
  130.       */
  131.       tzname[0] = tzname[1] = &s.chars[0];
  132.   #ifdef USG_COMPAT
  133. !     timezone = s.ttis[0].tt_gmtoff;
  134.       daylight = 0;
  135.   #endif /* USG_COMPAT */
  136.       for (i = 1; i < s.typecnt; ++i) {
  137.           register struct ttinfo *    ttisp;
  138.  
  139. --- 178,186 -----
  140.       ** Set tzname elements to initial values.
  141.       */
  142.       tzname[0] = tzname[1] = &s.chars[0];
  143.   #ifdef USG_COMPAT
  144. !     timezone = -s.ttis[0].tt_gmtoff;
  145.       daylight = 0;
  146.   #endif /* USG_COMPAT */
  147.       for (i = 1; i < s.typecnt; ++i) {
  148.           register struct ttinfo *    ttisp;
  149. ***************
  150. *** 193,201
  151.   #endif /* USG_COMPAT */ 
  152.           } else {
  153.               tzname[0] = &s.chars[ttisp->tt_abbrind];
  154.   #ifdef USG_COMPAT
  155. !             timezone = ttisp->tt_gmtoff;
  156.   #endif /* USG_COMPAT */ 
  157.           }
  158.       }
  159.       return 0;
  160.  
  161. --- 193,201 -----
  162.   #endif /* USG_COMPAT */ 
  163.           } else {
  164.               tzname[0] = &s.chars[ttisp->tt_abbrind];
  165.   #ifdef USG_COMPAT
  166. !             timezone = -ttisp->tt_gmtoff;
  167.   #endif /* USG_COMPAT */ 
  168.           }
  169.       }
  170.       return 0;
  171.  
  172. Index: northamerica
  173. *** OLD/northamerica    Sun Apr 12 22:28:23 1987
  174. --- northamerica    Sun Apr 12 22:28:40 1987
  175. ***************
  176. *** 1,5
  177. ! # @(#)northamerica    3.1
  178.   
  179.   # Despite the performance of existing (4.[123]BSD, System V Release 2.0) code,
  180.   # US Daylight Saving Time ended on the last Sunday of *October* in 1974.
  181.   # See, for example, the front page of the Saturday, October 26, 1974
  182.  
  183. --- 1,5 -----
  184. ! # @(#)northamerica    3.2
  185.   
  186.   # Despite the performance of existing (4.[123]BSD, System V Release 2.0) code,
  187.   # US Daylight Saving Time ended on the last Sunday of *October* in 1974.
  188.   # See, for example, the front page of the Saturday, October 26, 1974
  189. ***************
  190. *** 86,93
  191.   Zone    Canada/Newfoundland    -3:30    Canada        N%sT
  192.   Zone    Canada/Atlantic        -4:00    Canada        A%sT
  193.   Zone    Canada/Eastern        -5:00    Canada        E%sT
  194.   Zone    Canada/Central        -6:00    Canada        C%sT
  195.   Zone    Canada/Mountain        -7:00    Canada        M%sT
  196.   Zone    Canada/Pacific        -8:00    Canada        P%sT
  197.   Zone    Canada/Yukon        -9:00    Canada        Y%sT
  198.   
  199.  
  200. --- 86,94 -----
  201.   Zone    Canada/Newfoundland    -3:30    Canada        N%sT
  202.   Zone    Canada/Atlantic        -4:00    Canada        A%sT
  203.   Zone    Canada/Eastern        -5:00    Canada        E%sT
  204.   Zone    Canada/Central        -6:00    Canada        C%sT
  205. + Zone    Canada/East-Saskatchewan    -6:00    -    CST # No DST as of 1987
  206.   Zone    Canada/Mountain        -7:00    Canada        M%sT
  207.   Zone    Canada/Pacific        -8:00    Canada        P%sT
  208.   Zone    Canada/Yukon        -9:00    Canada        Y%sT
  209.   
  210.  
  211. Index: timemk.c
  212. *** OLD/timemk.c    Sun Apr 12 22:28:24 1987
  213. --- timemk.c    Sun Apr 12 22:28:42 1987
  214. ***************
  215. *** 3,11
  216.   /*LINTLIBRARY*/
  217.   
  218.   #ifndef lint
  219.   #ifndef NOID
  220. ! static char    sccsid[] = "@(#)timemk.c    3.1";
  221.   #endif /* !NOID */
  222.   #endif /* !lint */
  223.   
  224.   #ifdef STD_INSPIRED
  225.  
  226. --- 3,11 -----
  227.   /*LINTLIBRARY*/
  228.   
  229.   #ifndef lint
  230.   #ifndef NOID
  231. ! static char    sccsid[] = "@(#)timemk.c    3.2";
  232.   #endif /* !NOID */
  233.   #endif /* !lint */
  234.   
  235.   #ifdef STD_INSPIRED
  236. ***************
  237. *** 111,119
  238.               *timeptr = yourtm;    /* restore "original" value */
  239.               if (yourtm.tm_mday == 31) {
  240.                   timeptr->tm_mday = 1;
  241.                   ++(timeptr->tm_mon);
  242. !                 t = timemk(timeptr, funcp);
  243.                   if (t != WRONG)
  244.                       return t;
  245.                   *timeptr = yourtm;
  246.               } else if (yourtm.tm_mon == TM_FEBRUARY &&
  247.  
  248. --- 111,119 -----
  249.               *timeptr = yourtm;    /* restore "original" value */
  250.               if (yourtm.tm_mday == 31) {
  251.                   timeptr->tm_mday = 1;
  252.                   ++(timeptr->tm_mon);
  253. !                 t = timemk(timeptr, funcp, offset);
  254.                   if (t != WRONG)
  255.                       return t;
  256.                   *timeptr = yourtm;
  257.               } else if (yourtm.tm_mon == TM_FEBRUARY &&
  258. ***************
  259. *** 119,127
  260.               } else if (yourtm.tm_mon == TM_FEBRUARY &&
  261.                   yourtm.tm_mday > 28) {
  262.                       timeptr->tm_mday -= 28;
  263.                       ++(timeptr->tm_mon);
  264. !                     t = timemk(timeptr, funcp);
  265.                       if (t != WRONG)
  266.                           return t;
  267.                       *timeptr = yourtm;
  268.               }
  269.  
  270. --- 119,127 -----
  271.               } else if (yourtm.tm_mon == TM_FEBRUARY &&
  272.                   yourtm.tm_mday > 28) {
  273.                       timeptr->tm_mday -= 28;
  274.                       ++(timeptr->tm_mon);
  275. !                     t = timemk(timeptr, funcp, offset);
  276.                       if (t != WRONG)
  277.                           return t;
  278.                       *timeptr = yourtm;
  279.               }
  280.  
  281. Index: zic.8
  282. *** OLD/zic.8    Sun Apr 12 22:28:26 1987
  283. --- zic.8    Sun Apr 12 22:28:44 1987
  284. ***************
  285. *** 97,105
  286.   .B FROM
  287.   field.
  288.   .TP
  289.   .B TYPE
  290. ! Gives the type of year in which the year applies.
  291.   If
  292.   .B TYPE
  293.   is
  294.   .B \-
  295.  
  296. --- 97,105 -----
  297.   .B FROM
  298.   field.
  299.   .TP
  300.   .B TYPE
  301. ! Gives the type of year in which the rule applies.
  302.   If
  303.   .B TYPE
  304.   is
  305.   .B \-
  306. ***************
  307. *** 154,162
  308.   .B ON
  309.   field.
  310.   .TP
  311.   .B AT
  312. ! Gives the time of day at which the rule takes affect.
  313.   Recognized forms include:
  314.   .nf
  315.   .in +.5i
  316.   .sp
  317.  
  318. --- 154,162 -----
  319.   .B ON
  320.   field.
  321.   .TP
  322.   .B AT
  323. ! Gives the time of day at which the rule takes effect.
  324.   Recognized forms include:
  325.   .nf
  326.   .in +.5i
  327.   .sp
  328. ***************
  329. *** 290,294
  330.   .SH FILES
  331.   /etc/zoneinfo    standard directory used for created files
  332.   .SH "SEE ALSO"
  333.   newctime(3), tzfile(5), zdump(8)
  334. ! .. @(#)zic.8    3.1
  335.  
  336. --- 290,294 -----
  337.   .SH FILES
  338.   /etc/zoneinfo    standard directory used for created files
  339.   .SH "SEE ALSO"
  340.   newctime(3), tzfile(5), zdump(8)
  341. ! .. @(#)zic.8    3.2
  342.