[Zope] bobobase_modification_time one day back?

Tres Seaver tseaver@palladion.com
Fri, 03 Mar 2000 08:21:46 -0600


Brian Lloyd <Brian@digicool.com>
> 
> > Function TimeStamp_yad(int y) in
> > zope-2.1.4-src\lib\python\zodb\TimeStamp.c
> > expects a 1900 based year (i.e. 0 = 1900, 2000=100, etc.),
> > for positive agruments, when computing (y+300)/400.
> >
> > TimeStamp_abst(int y, int mo, int d, int m, int s)
> > seems to expect a 0 based year, on the other hand.
> >
> > l = y%4==0 && (y%100 != 0 || y%400==0)
> >
> > But it gets called with a 1900 based year in line 290 in
> > function TimeStamp_timeTime(
> >
> >             TimeStamp_abst(TimeStamp_y-1900, TimeStamp_m-
> > 1, TimeStamp_d-1,
> 
> Thanks for investigating this - because TimeStamp objects are
> used in the object database, I don't want to make any changes
> to this yet until I can talk to Jim and verify that the fix
> won't have any impact on ZODB code (mon. morning probably).

You might also look at TimeStamp_yad() (line 117 of the same file in 2.1.4)::

  static double
  TimeStamp_yad(int y)
  {
    double d, s;
  
    d=(y-1)*365;
    if (y > 0) 
      {
          s=1.0;
          y=y-1;
      }
    else
      {
        s=-1.0;
        y = -y;
      }
    return d+s*(y/4-y/100+(y+300)/400);
  }

I _think_ the last line should be::

    return d+s*((y/4)-(y/100)+(y/400));

"every fourth year, except century years, except every fourth century".  Perhaps
the original was "working" to compensate the base 1900 vs. base 0?

Tres.
-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com