🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.org.acm
Article #580

Re: year 2000 problem solution (more info.)

#580
From: Thad Smith
Date: Sat, 30 Mar 1996 16:16
78 lines
3467 bytes
In article <4j4jmc$12oi@msunews.cl.msu.edu>,
Andy Huang <huangxia@pilot.msu.edu> wrote:

> To our knowledge, other than our solution,  no one has offered  a
> good solution for the year 2000 problem. I do not feel that any company
> will use the Window technique since it does not work for indexed files nor
> SQL (sequel). To expand two digits to four digits is a very expensive
> approach and the process will be very slow. 

Since I don't work with accounting applications, I don't know the
usual techniques for handling dates there, but for programming traffic
light controllers I simply wrapped the two-digit code at a point other
than the century.  For my application, written around 1984, I probably
mapped the codes 80-99 to 1980-1999 and 00-79 to 2000-2079.  I
seriously doubt that the controllers I programmed will still be
running then, although many are probably still running now after 12
years.

Here is some simple code to illustrate:

/* Convert 2-digit year code */
#include <stdio.h>
#include <stdlib.h>

#define BASE_YY     80      /* allows years 1980 - 2079 */

/* Convert two-digit year code to range 1900+BASE_YY to 1999+BASE_YY */
int cvyear(
    int yy                  /* two-digit year code */
) {
    int year;                   /* actual year */

    if (yy >= BASE_YY) year = 1900 + yy;
    else               year = 2000 + yy;
    return year;
}

/* Convert year to two-digit code */
int cvyy (
    int year                /* 4 digit year */
) {
    if (year >= 2000)   return year - 2000;
    else                return year - 1900;
}

main(int argc, char *argv[]) {
    int yy = atoi(argv[1]);     /* two-digit year code */

    if (yy < 0 || yy > 99) {
        printf ("%d is invalid", yy);
    } else {
        printf ("year = %d\n", cvyear(yy));
    }
    return 0;
}

The technique was original with me, as I recall, and is hereby
released to the public domain for all to use.  You would use it by
reading in two-digit codes, converting to full years, manipulate with
years, then convert back to two-digit format for writing compatible
formats.  It's hard for me to imagine something much simpler.

> To get protection, attorneys suggest that we apply for a patent for this 
> intellectual property.  As you may know,  to get a patent approved takes 
> about two years. It takes a long time to investigate whether there are similar
> solutions in existence, etc. This is a problem for our case, if two years
> are wasted. After two years of investigation, this problem ( year 2000)
> will have become history, because government and industry must begin to act
> soon using currently know methods to fix this problem regardless of costs.
>
> Due to these reasons, if anyone can give me a good suggestion as to how to 
> use this solution without the legality of protection. it would be greatly 
> appreciated. 

You could license it under non-disclosure or simply do conversions for
a fee.

Thad
Technical Details
Message-ID: <4jjmo1$ck3@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4j4jmc$12oi@msunews.cl.msu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: thads@csn.net (Thad Smith)
Newsgroups: comp.org.acm,comp.lang.c.moderated
Subject: Re: year 2000 problem solution (more info.)
Date: 30 Mar 1996 10:16:01 -0600
Organization: T3 Systems
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4jjmo1$ck3@solutions.solon.com>
References: <4j4jmc$12oi@msunews.cl.msu.edu>
Reply-To: ThadSmith@acm.org
NNTP-Posting-Host: solutions.solon.com