I think you have too many zeros - I believe it should be:

         end = now + timeout->tv_sec * 100 + (timeout->tv_usec+9999) / 10000;

Cheers

Chris


On 09/05/2020 17:44, alan buckley wrote:

I don’t think this commit is correct. I checked the definition of select on Linux and it says the time is in microseconds and it should round up to the next clock update frequency. The original isn’t correct either.

I don’t know what the frequency is on RISC OS, but if it’s to a centi-second you will probably end up with something (untested) like:

           now = clock ();
          end = now + timeout->tv_sec * 100 + (timeout->tv_usec + 9999) / 1000000;

If I’m correct does Chris want to try if this fixes the problem he was having and resubmit his patch.

Regards,

Alan

*From:*riscos-commits-boun...@riscos.info <riscos-commits-boun...@riscos.info> on behalf of svnu...@riscos.info <svnu...@riscos.info>
*Sent:* Thursday, May 7, 2020 8:44:43 PM
*To:* riscos-comm...@riscos.info <riscos-comm...@riscos.info>
*Subject:* [GCCSDK commit] lee - r7304 - in trunk/gcc4/recipe/files/gcc/libunixlib: . unix

Author: lee
Date: 2020-05-07 12:44:43 -0700 (Thu, 07 May 2020)
New Revision: 7304

Modified:
   trunk/gcc4/recipe/files/gcc/libunixlib/ChangeLog
   trunk/gcc4/recipe/files/gcc/libunixlib/unix/ul_select.c
Log:
Thu May  7 20:35:36 BST  2020  Lee Noar <lee.n...@sky.com>

        * unix/ul_select.c(select): Fix time calculation so that the tv_usec
        part of the timeout is not ignored.
        Submitted by Chris Johns.


Modified: trunk/gcc4/recipe/files/gcc/libunixlib/ChangeLog
===================================================================
--- trunk/gcc4/recipe/files/gcc/libunixlib/ChangeLog 2020-04-27 19:07:44 UTC (rev 7303) +++ trunk/gcc4/recipe/files/gcc/libunixlib/ChangeLog 2020-05-07 19:44:43 UTC (rev 7304)
@@ -1,3 +1,9 @@
+Thu May  7 20:35:36 BST  2020  Lee Noar <lee.n...@sky.com>
+
+       * unix/ul_select.c(select): Fix time calculation so that the tv_usec
+       part of the timeout is not ignored.
+       Submitted by Chris Johns.
+
 Wed Apr  8 18:23:09 BST  2020  Lee Noar <lee.n...@sky.com>

         * module/sul.s: Bump version number to 1.16.

Modified: trunk/gcc4/recipe/files/gcc/libunixlib/unix/ul_select.c
===================================================================
--- trunk/gcc4/recipe/files/gcc/libunixlib/unix/ul_select.c 2020-04-27 19:07:44 UTC (rev 7303) +++ trunk/gcc4/recipe/files/gcc/libunixlib/unix/ul_select.c 2020-05-07 19:44:43 UTC (rev 7304)
@@ -180,8 +180,7 @@

           /* OK, so we can't cope with anything more than roughly 248.55 days!  */
           now = clock ();
-          end = now + timeout->tv_sec * 100
-                   + (50000 + timeout->tv_usec) / 1000000;
+         end = now + timeout->tv_sec * 100 + timeout->tv_usec / 10000;
         }
     }



_______________________________________________
riscos-commits mailing list
riscos-comm...@riscos.info
http://www.riscos.info/cgi-bin/mailman/listinfo/riscos-commits


_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK
_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Reply via email to