Subj : not ignoring you... but...
To : Wayne Steele
From : Scott Little
Date : Fri Jul 09 2004 06:26 am
[ 03 Jul 04 12:01, Wayne Steele wrote to All ]
WS> I've done further investigations into this EleBBS/WEB 1 day message
WS> problem and found that if I have a hudson or a Squish message base
WS> the DATE is correct so it is only in a JAM message area... As far as
WS> I can tell EleBBS uses Mark May's Source code... So would this narrow
WS> it down to maybe a MKMSGJAM.PAS problem?
Gawd DAY-EM! What a rats' nest.
First, you should have your TZ environment variable set. TZ=EST-10 if you're
in Sydney/Melb/etc.
Second, it looks like unix2norm() is FUBAR. Which is really odd since a simple
unix2norm(norm2unix()) would tell you it's broken, and this is a piece of code
that's been floating around for ages (and obviously used by many people). The
fix eludes me (at 5am), so I rewrote it. This isn't well tested, but it Works
For Me. I can compile Win32 and Linux binaries, if you're running OS/2 or
something you'll have to compile it yourself. Just replace unix2norm with the
following in elebbs/src/unixdate.pas.
Procedure Unix2Norm(Date: LongInt; var Year, Month, Day, Hour, Min, Sec: Word);
(* Scott Little, 2004-07-04
"Day" was always one day late, except for the first day of the month.
Couldn't fix. Rewrote. Untested.
*)
var
Done : Boolean;
X : ShortInt;
TotDays : Integer;
begin
Year := 1970;
Month := 01;
Day := 01;
Hour := 00;
Min := 00;
Sec := 00;
Date := Date + (GetTimeZone * SecsPerHour); { Local time/date }
while Date >= SecsPerYear do
begin
if IsLeapYear(Year) and (Date < SecsPerLeapYear) then
break;
if IsLeapYear(Year) and (Date >= SecsPerLeapYear) then
begin
Inc(Year, 1);
Dec(Date, SecsPerLeapYear);
end
else
begin
Inc(Year, 1);
Dec(Date, SecsPerYear);
end;
end;
TotDays := Date DIV SecsPerDay;
for X := 12 downto 1 do
begin
if X = 1 then
break;
if isLeapYear(Year) and (TotDays >= DaysPerLeapYear[X - 1]) then
begin
Dec(Date, DaysPerLeapYear[X - 1] * SecsPerDay);
Dec(Totdays, DaysPerLeapYear[X - 1]);
break;
end
else if (not isLeapYear(Year)) and (TotDays >= DaysPerYear[X - 1]) then
begin
Dec(Date, DaysPerYear[X - 1] * SecsPerDay);
Dec(Totdays, DaysPerYear[X - 1]);
break;
end;
end;
Month := X;
Day := TotDays + 1;
Dec(Date, (Day - 1) * SecsPerDay);
Hour := Date DIV SecsPerHour;
Dec(Date, Hour * SecsPerHour);
Min := Date DIV SecsPerMinute;
Dec(Date, Min * SecsPerMinute);
Sec := Date;
end; { proc. Unix2Norm }
-- Scott Little [fidonet#3:712/848 /
[email protected]]
--- GoldED+/W32 1.1.5-31012
* Origin: Cyberia: 100% Grade "A" mansteak baby. (3:712/848)