[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: y2k (ITS#294)



Applied to -devel and OPENLDAP_REL_ENG_1_2, please test.

At 07:56 PM 9/17/99 GMT, hby@umich.edu wrote:
>Full_Name: howard b young
>Version: 1.2.7
>OS: solaris 2.6
>URL: ftp://ftp.openldap.org/incoming/
>Submission from: (NULL) (141.211.144.18)
>
>
>We where testing some finger stuff and encounted what seemed to be a problem in
>
>reporting dates > year 2000. Tacked it down to the file
>libraries/libldap/tmplout.c,
>module time2text. The following seems to fix the problem. (In the cases of 14
>digit 
>times the offset from 1900 hundred was determined then thrown away. For 12
>digit
>times the standard y2k hack was not being use.)
>
>-- tmplout.c.org       Tue Mar  2 13:30:05 1999
>+++ tmplout.c   Fri Sep 17 15:19:02 1999
>@@ -895,13 +895,20 @@
> 
>     p = ldtimestr;
> 
>-       if( ndigits == 14) {
>-               /* came with a century */
>-               /* POSIX says tm_year should be year - 1900 */
>-       t.tm_year = 100 * GET2BYTENUM( p ) - 1900;
>-               p += 2;
>-       }
>-    t.tm_year = GET2BYTENUM( p ); p += 2;
>+    if( ndigits == 14) {
>+        /* came with a century */
>+        /* POSIX says tm_year should be year - 1900 */
>+        t.tm_year = 100 * GET2BYTENUM( p ) - 1900;
>+        p += 2;
>+        t.tm_year += GET2BYTENUM( p ); p += 2;
>+    }
>+    else
>+    {
>+        t.tm_year = GET2BYTENUM( p ); p += 2;
>+        /* Y2K hack  - 2 digit years < 70 are 21st century */
>+        if (t.tm_year < 70) 
>+            t.tm_year += 100;
>+    }
> 
>     t.tm_mon = GET2BYTENUM( p ) - 1; p += 2;
>     t.tm_mday = GET2BYTENUM( p ); p += 2;
>
>
>
>
>
>