TIP: Click on subject to list as thread! ANSI
echo: fidosoft.husky
to: andrew clarke
from: Oli
date: 2021-02-14 16:47:00
subject: Squish __ftsc_date bug /

andrew wrote (2021-02-14):

 ac> 14 Feb 21 11:28, you wrote to me:

 Ol>> I tested it with a JAM base and it still works. But it turned out a
 Ol>> rescan from a JAM base also modifies time stamps:

 Ol>> Original:
 Ol>> Date and time      : 09 Feb 21  06:31:33

 Ol>> After rescan from JAM:
 Ol>> Date and time      : 09 Feb 21  06:31:32

 Ol>> Which means Squish can be fixed, but JAM has the same problem (I
 Ol>> tested JAM with hpt from github master without any patch).

 Ol>> Maybe a problem/bug within SMAPI (JAM jammed into the Squish API)?

 ac> api_jam.c:JamReadMsg() has this:

 ac>          scombo = (SCOMBO *)(&(msg->date_written));
 ac>          scombo = TmDate_to_DosDate(s_time, scombo);
 ac>          /* ftsdate = msg->__ftsc_date; */
 ac>          ftsdate = (unsigned char *)sc_time(scombo, (char
 *)(msg->> __ftsc_date));

 ac> But maybe the correct code should be:

 ac>          if (*msg->__ftsc_date)
 ac>          {
 ac>              ftsdate = msg->__ftsc_date;
 ac>          }
 ac>          else
 ac>          {
 ac>              scombo = (SCOMBO *)(&(msg->date_written));
 ac>              scombo = TmDate_to_DosDate(s_time, scombo);
 ac>              ftsdate = (unsigned char *)sc_time(scombo, (char *)(msg->__ftsc_date)); }

Mhh, a JAM message base doesn't have an __ftsc_date field, I don't understand this piece of the code.

What about the TmDate_to_DosDate conversion?

union stamp_combo *_fast TmDate_to_DosDate(struct tm *tmdate, union stamp_combo *dosdate)
{
    if(tmdate && dosdate)
    {
        dosdate->msg_st.date.da = tmdate->tm_mday;
        dosdate->msg_st.date.mo = tmdate->tm_mon + 1;
        dosdate->msg_st.date.yr = tmdate->tm_year - 80;

        dosdate->msg_st.time.hh = tmdate->tm_hour;
        dosdate->msg_st.time.mm = tmdate->tm_min;
        dosdate->msg_st.time.ss = tmdate->tm_sec >> 1;
                                          ^^^^^^^^^^^^
    }

    return dosdate;
}

AFAIK the JAM format doesn't use DOS Time at all. It seems to be an unnecessary lossy conversion.

                                                                                                                        
* Origin: . (2:280/464.47)

SOURCE: echomail via QWK@pharcyde.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.