-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2007, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
pragma Convention (C, struct_timeval);
procedure gettimeofday
- (tv : access struct_timeval;
+ (tv : not null access struct_timeval;
tz : Address := Null_Address);
pragma Import (C, gettimeofday, "gettimeofday");
readfds,
writefds,
exceptfds : Address := Null_Address;
- timeout : access struct_timeval);
+ timeout : not null access struct_timeval);
pragma Import (C, C_select, "select");
-----------
is
Rel_Time : Duration;
Abs_Time : Duration;
- Check_Time : Duration := Clock;
+ Base_Time : constant Duration := Clock;
+ Check_Time : Duration := Base_Time;
timeval : aliased struct_timeval;
begin
C_select (timeout => timeval'Unchecked_Access);
Check_Time := Clock;
- exit when Abs_Time <= Check_Time;
+ exit when Abs_Time <= Check_Time or else Check_Time < Base_Time;
Rel_Time := Abs_Time - Check_Time;
end loop;