Y2K-Bug in INN 1.x, 2.x

Per Hedeland per at erix.ericsson.se
Wed Jan 5 17:26:41 UTC 2000


Katsuhiro Kondou <kondou at nec.co.jp> wrote:
>In article <200001051138.MAA03180 at aalborg.du.uab.ericsson.se>,
>	Per Hedeland <per at erix.ericsson.se> wrote;
>
>} but I believe it "should" be something like this in the "< 100" branches:
>
>Reasonable to me.  I'm going to fix based on this,
>if no one ojbects.

Um, this code must have been written thousands of times in the past few
years, but never by me:-) - I was hoping someone would offer a cleaner
expression... Oh well, I think in C the best one is this:

With:

  y_in  = some "nearby" two-digit year
  y_now = current four-digit year

- the four-digit version of y_in is given by:

  y_out = y_in + (y_now / 100 + (y_now % 100 - y_in) / 50) * 100;

(I.e. century part is same as current if difference between two-digit
parts is within +/- 50, otherwise subtract or add 1 depending on
direction of difference.)

For parsedate.y you of course substitute

y_in  -> $n
y_now -> yyYear
y_out -> yyYear

--Per Hedeland
per at erix.ericsson.se



More information about the inn-workers mailing list