• ctot error

    From Claude R@21:1/5 to All on Mon Aug 21 07:12:54 2023
    Hello,
    Please try this:

    set date format to "dd/mm/yyyyy"
    alert(ttoc(ctot('21/08/2023 13:31:08.228')))

    gives here result '21/08/2023 13:31:08.227' (!)

    Is this bug still in latest version ?
    Claude R.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Mon Aug 21 17:43:13 2023
    Il 21/08/2023 16:12, Claude R ha scritto:

    Hello,
    Please try this:

    set date format to "dd/mm/yyyyy"
    alert(ttoc(ctot('21/08/2023 13:31:08.228')))

    gives here result '21/08/2023 13:31:08.227' (!)

    Is this bug still in latest version ?

    Yes, there is. :-(

    I don't know how to fix it, sorry. Ron?

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Mon Aug 21 19:44:47 2023
    Il 21/08/2023 19:43, Enrico Maria Giordano ha scritto:

    I don't think so, at least not at the CTOD() function level. The value
    of s_value here is 8.228000:

    hb_retdt( y_value, m_value, d_value, h_value, n_value, s_value, 0 );

    But the displayed value is:

    21/08/2023 13:31:08.227

    So the bug seem to be inside hb_retdt() function. Too much for me... :-(

    But if someone have any experiments to suggest I will be glad to try to
    make it.

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Mon Aug 21 19:43:28 2023
    Il 21/08/2023 19:27, Ron Pinkas ha scritto:

    I am not familiar with the datetime implementation, but IIYC this ie likely a floating point arithmetic limitation issue.

    I don't think so, at least not at the CTOD() function level. The value
    of s_value here is 8.228000:

    hb_retdt( y_value, m_value, d_value, h_value, n_value, s_value, 0 );

    But the displayed value is:

    21/08/2023 13:31:08.227

    So the bug seem to be inside hb_retdt() function. Too much for me... :-(

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ron Pinkas@21:1/5 to Enrico Maria Giordano on Mon Aug 21 10:27:22 2023
    On Monday, August 21, 2023 at 10:43:13 AM UTC-5, Enrico Maria Giordano wrote:
    Il 21/08/2023 16:12, Claude R ha scritto:

    Hello,
    Please try this:

    set date format to "dd/mm/yyyyy"
    alert(ttoc(ctot('21/08/2023 13:31:08.228')))

    gives here result '21/08/2023 13:31:08.227' (!)

    Is this bug still in latest version ?
    Yes, there is. :-(

    I don't know how to fix it, sorry. Ron?

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    I am not familiar with the datetime implementation, but IIYC this ie likely a floating point arithmetic limitation issue.

    Ron

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Thu Aug 24 17:06:48 2023
    Thanks to Richard Visscher that pointed me to the bugged function, I
    could fixed this bug:


    long hb_timeEncode( int iHour, int iMinute, double dSeconds )
    {
    HB_TRACE( HB_TR_DEBUG, ( "hb_timeEncode(%d, %d, %f)", iHour,
    iMinute, dSeconds ) );
    //printf( "hb_timeEncode(%d, %d, %f)", lHour, lMinute, dSeconds);

    if( iHour >= 0 && iHour <= 23 && iMinute >= 0 && iMinute <= 59 &&
    dSeconds >= 0 && dSeconds < 60 )
    {
    return ( long ) ( iHour * 3600 * HB_DATETIMEINSEC + iMinute * 60
    * HB_DATETIMEINSEC + dSeconds * HB_DATETIMEINSEC ); // The bug was here!!!
    }

    return 0;
    }

    Please commit.

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Thu Aug 24 17:19:33 2023
    Il 24/08/2023 17:06, Enrico Maria Giordano ha scritto:

          return ( long ) ( iHour * 3600 * HB_DATETIMEINSEC + iMinute * 60 * HB_DATETIMEINSEC + dSeconds * HB_DATETIMEINSEC );  // The bug was here!!!

    But please, verify my fix before committing it!

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)