aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/g-socket.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/libgnat/g-socket.adb')
-rw-r--r--gcc/ada/libgnat/g-socket.adb9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/ada/libgnat/g-socket.adb b/gcc/ada/libgnat/g-socket.adb
index 5042dac..0fed791 100644
--- a/gcc/ada/libgnat/g-socket.adb
+++ b/gcc/ada/libgnat/g-socket.adb
@@ -3059,12 +3059,11 @@ package body GNAT.Sockets is
-- Normal case where we do round down
else
- S := time_t (Val - 0.5);
- uS := suseconds_t (1_000_000 * (Val - Selector_Duration (S)) - 0.5);
-
- if uS = -1 then
- -- It happen on integer duration
+ S := time_t (Val - 0.5);
+ if Val = Timeval_Duration (S) then
uS := 0;
+ else
+ uS := suseconds_t ((Val - Timeval_Duration (S)) * 1_000_000 - 0.5);
end if;
end if;