aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDmitriy Anisimkov <anisimko@adacore.com>2021-05-19 18:26:16 +0600
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-07 16:23:15 +0000
commit4fa7097a140f007f86e81f62cd08fff15b16ef6e (patch)
tree27d76710ccadcb9393e98391f481cf8ed4ca97bd /gcc
parentebef9784ef665511b407ed9081153a7eb52f816b (diff)
downloadgcc-4fa7097a140f007f86e81f62cd08fff15b16ef6e.zip
gcc-4fa7097a140f007f86e81f62cd08fff15b16ef6e.tar.gz
gcc-4fa7097a140f007f86e81f62cd08fff15b16ef6e.tar.bz2
[Ada] Timeout correction on Get_Socket_Option
gcc/ada/ * libgnat/g-socket.adb (Get_Socket_Option): Add 500ms only when Minus_500ms_Windows_Timeout is True. (Set_Socket_Option): Use "* 1000" instead of "/ 0.001" to convert to milliseconds.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/libgnat/g-socket.adb16
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/ada/libgnat/g-socket.adb b/gcc/ada/libgnat/g-socket.adb
index a246303..75a2b27 100644
--- a/gcc/ada/libgnat/g-socket.adb
+++ b/gcc/ada/libgnat/g-socket.adb
@@ -1570,14 +1570,18 @@ package body GNAT.Sockets is
| Send_Timeout
=>
if Is_Windows then
-
- -- Timeout is in milliseconds, actual value is 500 ms +
- -- returned value (unless it is 0).
-
if U4 = 0 then
Opt.Timeout := 0.0;
+
else
- Opt.Timeout := Duration (U4) / 1000 + 0.500;
+ if Minus_500ms_Windows_Timeout then
+ -- Timeout is in milliseconds, actual value is 500 ms +
+ -- returned value (unless it is 0).
+
+ U4 := U4 + 500;
+ end if;
+
+ Opt.Timeout := Duration (U4) / 1000;
end if;
else
@@ -2724,7 +2728,7 @@ package body GNAT.Sockets is
Len := U4'Size / 8;
Add := U4'Address;
- U4 := C.unsigned (Option.Timeout / 0.001);
+ U4 := C.unsigned (Option.Timeout * 1000);
if Option.Timeout > 0.0 and then U4 = 0 then
-- Avoid round to zero. Zero timeout mean unlimited