![]() |
"Frans E. van Dorsselaer" <frans@bia-bv.demon.nl> writes: > I use hylafax 4.0pl2 on Suse Linux 6.1, but the problem > appears to be present in the current CVS as well. > Since 1/1/2000 faxcron reports _all_ faxes ever sent in > the receive stats, transmission stats, and error log report. > > The receive/transmit stats are done in scripts called > recvstats and xferstats respectively, I fixed those (patch attached). > The problem is due to calculation of the age based on > YY * 365 + ..., where YY is a 2-digit year representation. > Fix includes YY < 70 check. > > The error reports are filtered from faxcron itself, using > awk. I'm not good at awk, and I haven't tracked down the > problem further. > > Bye, > > Frans van Dorsselaer > frans@bia-bv.demon.nl > > > --- orig.recvstats Mon Jan 3 00:11:45 2000 > +++ recvstats Mon Jan 3 00:12:20 2000 > @@ -157,7 +157,10 @@ > # > function cvtDateTime(s) > { > - yday = substr(s,7,2)*365 + substr(s,4,2) - 1; > + yday = substr(s,7,2); > + if (yday < 70) > + yday += 100; > + yday = yday*365 + substr(s,4,2) - 1; > mon = substr(s,0,2) + 0; > for (i = 0; i < mon; i++) > yday += daysInMonth[i]; > --- orig.xferstats Mon Jan 3 00:03:55 2000 > +++ xferstats Mon Jan 3 00:11:08 2000 > @@ -186,7 +186,10 @@ > # > function cvtDateTime(s) > { > - yday = substr(s,7,2)*365 + substr(s,4,2) - 1; > + yday = substr(s,7,2); > + if (yday < 70) > + yday += 100; > + yday = yday*365 + substr(s,4,2) - 1; > mon = substr(s,0,2) + 0; > for (i = 0; i < mon; i++) > yday += daysInMonth[i]; It seems that you run Alpha or other 64-bit box :-) On the 32-bit processors the above code gives incorrect result due to an overflow. And it also contains an older bug : substr(s,0,2) instead of substr(s,1,2). It means that xferstats/recvstats _never_ generated correct results. I wonder why nobody noticed that before. So, here is the function with my fixes applied: function cvtDateTime(s) { yday = substr(s,7,2); if (yday < 70) yday += 30; else yday -= 70; yday = yday*365 + substr(s,4,2) - 1; mon = substr(s,1,2) + 0; for (i = 0; i < mon; i++) yday += daysInMonth[i]; return yday*FULLDAY + cvtTime(substr(s,10) ":00"); } Hope to hear from you soon, Dmitry