Subj : not ignoring you... but... To : Wayne Steele From : mark lewis Date : Wed Jul 07 2004 01:49 am ml> FWIW: i have several tools that create messages in JAM bases ml> and they all use mark's code... none of them exhibit this ml> problem... this got out before i had a chance to add this... i just looked at the MKMSGJAM that i have and i do see these two notes at the top... { changed MSGTIME from 5 characters to 8 characters to get real seconds instead of forcing them to zero. MFL - 13 June 96 added SETATTR procedure to allow specific access to attributes MFL - 9 June 96 } it is possible that i may have fixed something else, too... i note that the date stuff is also run thru several conversions... the date is run thru DTToUnixDate which converts the borland DT (datetime) format to unixtime format... unixtime format is the number of seconds since 1970, IIRC... part of that process is to convert the days past from gregorian to julian... here are those routines and the few variables... check that you find them as so in your code... [from MKMISC.PAS] Const C1970 = 2440588; D0 = 1461; D1 = 146097; D2 = 1721119; [...] {$IFDEF WINDOWS} Function GregorianToJulian(DT: TDateTime): LongInt; {$ELSE} Function GregorianToJulian(DT: DateTime): LongInt; {$ENDIF} Var Century: LongInt; XYear: LongInt; Temp: LongInt; Month: LongInt; Begin Month := DT.Month; If Month <= 2 Then Begin Dec(DT.Year); Inc(Month,12); End; Dec(Month,3); Century := DT.Year Div 100; XYear := DT.Year Mod 100; Century := (Century * D1) shr 2; XYear := (XYear * D0) shr 2; GregorianToJulian := ((((Month * 153) + 2) div 5) + DT.Day) + D2 + XYear + Century; End; [...] {$IFDEF WINDOWS} Function DTToUnixDate(DT: TDateTime): LongInt; {$ELSE} Function DTToUnixDate(DT: DateTime): LongInt; {$ENDIF} Var SecsPast, DaysPast: LongInt; Begin DaysPast := GregorianToJulian(DT) - c1970; SecsPast := DaysPast * 86400; SecsPast := SecsPast + (LongInt(DT.Hour) * 3600) + (DT.Min * 60) + (DT.Sec); DTToUnixDate := SecsPast; End; [... and then back to the routine in MKMSGJAM.PAS ...] Function JamMsgObj.WriteMsg: Word; Var {$IFDEF WINDOWS} DT: TDateTime; {$ELSE} DT: DateTime; {$ENDIF} WriteError: Word; i: Word; TmpIdx: JamIdxType; Begin WriteError := 0; If LastSoft Then Begin DoChar(#13); DoChar(#10); End; If WriteError = 0 Then Begin MsgHdr^.JamHdr.Signature[1] := 'J';{Set signature} MsgHdr^.JamHdr.Signature[2] := 'A'; MsgHdr^.JamHdr.Signature[3] := 'M'; MsgHdr^.JamHdr.Signature[4] := #0; Case JM^.MailType of mmtNormal: SetAttr1(Jam_TypeLocal, True); mmtEchoMail: SetAttr1(Jam_TypeEcho, True); mmtNetMail: SetAttr1(Jam_TypeNet, True); End; MsgHdr^.JamHdr.Rev := 1; MsgHdr^.JamHdr.DateArrived := ToUnixDate(GetDosDate); {Get date processed} DT.Year := Str2Long(Copy(JM^.MsgDate, 7, 2)); {Convert date written} DT.Month := Str2Long(Copy(JM^.MsgDate, 1, 2)); DT.Day := Str2Long(Copy(JM^.MsgDate, 4, 2)); If DT.Year < 80 Then Inc(DT.Year, 2000) Else Inc(DT.Year, 1900); { DT.Sec := 0; } DT.Sec := Str2Long(Copy(JM^.MsgTime, 7, 2)); DT.Hour := Str2Long(Copy(JM^.MsgTime, 1, 2)); DT.Min := Str2Long(Copy(JM^.MsgTime, 4, 2)); MsgHdr^.JamHdr.DateWritten := DTToUnixDate(DT); End; there is more code in this routine but this is the code leading up to the setting of the date written... do you have the same problem with the setting of the date arrived? they should be the same for locally (on the bbs) written messages... you can see my alteration as noted for setting actual seconds in the time field instead of forcing them to zero... i did this alteration in an effort to get around buggy code that thinks that numerous messages written in the same second are duplicates... i have tested my stuff from this blackbox library at generating several hundred messages per minutes without then being caught as dupes ;) tracing a bit "further on", we find this code... Procedure JamMsgObj.StartNewMsg; Begin JM^.TxtBufStart := 0; JM^.TxtPos := 0; FillChar(MsgHdr^, SizeOf(MsgHdr^), #0); MsgHdr^.JamHdr.SubFieldLen := 0; MsgHdr^.JamHdr.MsgIdCrc := -1; MsgHdr^.JamHdr.ReplyCrc := -1; MsgHdr^.JamHdr.PwdCrc := -1; JM^.MsgTo := ''; JM^.MsgFrom := ''; JM^.MsgSubj := ''; FillChar(JM^.Orig, SizeOf(JM^.Orig), #0); FillChar(JM^.Dest, SizeOf(JM^.Dest), #0); JM^.MsgDate := DateStr(GetDosDate); JM^.MsgTime := TimeStr(GetDosDate); End; this indicates that the date the message is written comes from the GetDosDate routine... that's a simple routine that gets the date and time from the system clock and packs it into the longint that GetDosDate returns... from what i can tell, StartNewMsg is the first place in the code that the date of the message is set and its done automatically by the above which just reads the system clock... [time passes] i see in my code that i do the following... init the message == StartNewMsg set the addresses to/from == SetDest and SetOrig set the attributes == many Set* routines put the control lines == DoStringLn and/or DoKludgeLn load the message text body == DoString and DoStringLn write the message to the message base == WriteMsg i note that when i set the attributes, that i also set the date in the same basic way that was already done... i don't remember why i set the date again... possibly because it wasn't being done when i first started using the msg kit and then after some updates, it was... no matter, really, both use the same DateStr(GetDosDate)... i do mine with the SetDate routine whereas the other is done directly into the same JM^.MsgDate variable... i could do this also via msgout^.JM^.MsgDate IIRC but the SetDate routine is easier since it is supposed to be used in a blackbox fashion ;) DateStr formats the date to MM-DD-YY format with leading zeros where needed... am i going to have to go digging thru the Elebbs code? OB-) )\/(ark * Origin: (1:3634/12) .