anchor.diff:      {A,B,C}=erlang:now(),
       (A*1000000*1000)+(B*1000)+(C div 1000).
   	
  -collect_accepts(Tmo) ->
  +collect_accepts(0,_) -> [];
  +collect_accepts(N,Tmo) ->
       A = millis(),
       receive
   	{accepted,P,Msg} ->
  -	    [{P,Msg}] ++ collect_accepts(Tmo-(millis() - A))
  +	    [{P,Msg}] ++ collect_accepts(N-1,Tmo-(millis() - A))
       after Tmo ->
   	    []
       end.
      
  --define(EXPECT_ACCEPTS(Pattern,Timeout),
  +-define(EXPECT_ACCEPTS(Pattern,N,Timeout),
   	(fun() ->
  -		 case collect_accepts(Timeout) of
  +                 case collect_accepts(if N =:= infinity -> -1; true -> N end,Timeout) of
   		     Pattern ->
   			 ok;
   		     Other ->
  
positive.code:     ?line spawn(F),
      ?line gen_tcp:close(LS),
      ?line ?EXPECT_ACCEPTS([{_,{error,closed}},{_,{error,closed}},
  			   {_,{error,closed}},{_,{error,closed}}], 500).
  	
  accept_timeout(suite) ->
      [];
  
negative.code:     ["checks that multi-accept works when more than one accept can be "
       "done at once (wb test of inet_driver)"];
  several_accepts_in_one_go(Config) when is_list(Config) ->
      {ok,LS}=gen_tcp:listen(0,[]),
      Parent = self(),
      {ok,PortNo}=inet:port(LS),
      F1 = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end,
      F2 = fun() -> Parent ! {connected,self(),gen_tcp:connect("localhost",PortNo,[])} end,
      Ns = lists:seq(1,8),
      _  = [spawn(F1) || _ <- Ns],
      ok = ?EXPECT_ACCEPTS([],1,500), % wait for tmo
      _  = [spawn(F2) || _ <- Ns],
      ok = ?EXPECT_ACCEPTS([{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}}],8,15000),
      ok = ?EXPECT_CONNECTS([{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}},{_,{ok,_}}],1000),
      ok.
  
  
  