From 29ea5c7576b4ee21a9e0cb9f6875ce9c1bc28d71 Mon Sep 17 00:00:00 2001 From: James Aimonetti Date: Tue, 29 Dec 2015 11:20:32 -0800 Subject: [PATCH] KAZOO-4394: latest spec/type updates --- core/whistle-1.0.0/src/wh_util.erl | 2 +- .../rest_pastebin/src/toppage_handler.erl | 2 +- deps/erlydtl-0.9.4/src/erlydtl_filters.erl | 2 +- .../src/escalus_bosh.erl | 2 +- .../src/escalus_history_h.erl | 4 +- deps/exmpp-0.9.9/src/network/exmpp_bosh.erl | 2 +- .../src/network/exmpp_component.erl | 2 +- deps/exmpp-0.9.9/src/network/exmpp_dns.erl | 2 +- .../exmpp-0.9.9/src/network/exmpp_session.erl | 4 +- .../ibrowse-4.0.1/src/ibrowse_http_client.erl | 4 +- deps/ibrowse-4.0.1/src/ibrowse_lib.erl | 2 +- deps/ibrowse-4.0.1/src/ibrowse_test.erl | 8 ++-- deps/mochiweb-2.4.2/src/mochiweb_acceptor.erl | 4 +- deps/nksip-0.4.0/include/nksip.hrl | 2 +- .../nksip_loadtest/src/nksip_loadtest_lib.erl | 8 ++-- .../rabbitmq-erlang-client/test/test_util.erl | 2 +- .../src/rabbit_federation_upstream.erl | 2 +- .../src/rabbit_shovel_worker.erl | 2 +- .../sockjs-erlang-git/src/sockjs_filters.erl | 2 +- .../sockjs-erlang-git/src/sockjs_util.erl | 2 +- .../webmachine-git/src/webmachine.erl | 2 +- .../src/webmachine_decision_core.erl | 4 +- .../webmachine-git/src/webmachine_request.erl | 2 +- .../src/webmachine_resource.erl | 2 +- .../webmachine-git/src/webmachine_util.erl | 6 +-- .../src/file_handle_cache.erl | 10 ++--- .../rabbitmq_server-3.5.5/src/gen_server2.erl | 6 +-- deps/rabbitmq_server-3.5.5/src/gm.erl | 2 +- .../src/rabbit_amqqueue_process.erl | 4 +- .../src/rabbit_auth_backend_internal.erl | 2 +- .../src/rabbit_channel.erl | 2 +- .../rabbitmq_server-3.5.5/src/rabbit_guid.erl | 2 +- .../src/rabbit_mirror_queue_mode_exactly.erl | 2 +- .../rabbitmq_server-3.5.5/src/rabbit_misc.erl | 2 +- .../src/rabbit_queue_consumers.erl | 2 +- .../src/rabbit_variable_queue.erl | 2 +- .../rabbitmq_server-3.5.5/src/time_compat.erl | 2 +- deps/socketio-0.1.0/src/uuids.erl | 2 +- scripts/update-the-types.sh | 38 ++++++++++++------- 39 files changed, 82 insertions(+), 72 deletions(-) diff --git a/core/whistle-1.0.0/src/wh_util.erl b/core/whistle-1.0.0/src/wh_util.erl index 3ebb2bb7f55..f77eabddce0 100644 --- a/core/whistle-1.0.0/src/wh_util.erl +++ b/core/whistle-1.0.0/src/wh_util.erl @@ -1334,7 +1334,7 @@ elapsed_us({_,_,_}=Start, Now) -> elapsed_us(now_s(Start), Now); elapsed_us(Start, {_,_,_}=Now) -> elapsed_us(Start, now_s(Now)); elapsed_us(Start, Now) when is_integer(Start), is_integer(Now) -> (Now - Start) * 1000000. --spec now() -> wh_now(). +-spec erlang:timestamp() -> wh_now(). -ifdef(OTP_AT_LEAST_18). now() -> erlang:timestamp(). diff --git a/deps/cowboy-0.10.0/examples/rest_pastebin/src/toppage_handler.erl b/deps/cowboy-0.10.0/examples/rest_pastebin/src/toppage_handler.erl index be2b803e01e..76ae0c54957 100644 --- a/deps/cowboy-0.10.0/examples/rest_pastebin/src/toppage_handler.erl +++ b/deps/cowboy-0.10.0/examples/rest_pastebin/src/toppage_handler.erl @@ -17,7 +17,7 @@ init(_Transport, _Req, []) -> % For the random number generator: - {X, Y, Z} = now(), + {X, Y, Z} = erlang:timestamp(), random:seed(X, Y, Z), {upgrade, protocol, cowboy_rest}. diff --git a/deps/erlydtl-0.9.4/src/erlydtl_filters.erl b/deps/erlydtl-0.9.4/src/erlydtl_filters.erl index 6ec4981793d..440f68d9fc5 100644 --- a/deps/erlydtl-0.9.4/src/erlydtl_filters.erl +++ b/deps/erlydtl-0.9.4/src/erlydtl_filters.erl @@ -531,7 +531,7 @@ random(_) -> "". random_num(Value) -> - random:seed(now()), + random:seed(erlang:timestamp()), random:uniform(Value). %% random tags to be used when using erlydtl in testing diff --git a/deps/escalus-0f0f6367c2a7adbe3fafce26bb9ba15502d155f7/src/escalus_bosh.erl b/deps/escalus-0f0f6367c2a7adbe3fafce26bb9ba15502d155f7/src/escalus_bosh.erl index 56899113004..abdca5f2ece 100644 --- a/deps/escalus-0f0f6367c2a7adbe3fafce26bb9ba15502d155f7/src/escalus_bosh.erl +++ b/deps/escalus-0f0f6367c2a7adbe3fafce26bb9ba15502d155f7/src/escalus_bosh.erl @@ -254,7 +254,7 @@ init([Args, Owner]) -> HostStr = host_to_list(Host), OnReplyFun = proplists:get_value(on_reply, Args, fun(_) -> ok end), OnConnectFun = proplists:get_value(on_connect, Args, fun(_) -> ok end), - {MS, S, MMS} = now(), + {MS, S, MMS} = erlang:timestamp(), InitRid = MS * 1000000 * 1000000 + S * 1000000 + MMS, {ok, Parser} = exml_stream:new_parser(), {ok, Client} = fusco_cp:start_link({HostStr, Port, HTTPS}, diff --git a/deps/escalus-0f0f6367c2a7adbe3fafce26bb9ba15502d155f7/src/escalus_history_h.erl b/deps/escalus-0f0f6367c2a7adbe3fafce26bb9ba15502d155f7/src/escalus_history_h.erl index 2757c2325c1..96876e6cc98 100644 --- a/deps/escalus-0f0f6367c2a7adbe3fafce26bb9ba15502d155f7/src/escalus_history_h.erl +++ b/deps/escalus-0f0f6367c2a7adbe3fafce26bb9ba15502d155f7/src/escalus_history_h.erl @@ -61,8 +61,8 @@ terminate(_, _) -> save_stanza(Type, Jid, Stanza, State=#state{events = Events}) -> State#state{ - events = [{stanza, Type, Jid, now(), Stanza}|Events]}. + events = [{stanza, Type, Jid, erlang:timestamp(), Stanza}|Events]}. save_story_event(Type, State=#state{events = Events}) -> State#state{ - events = [{story, Type, now()}|Events]}. + events = [{story, Type, erlang:timestamp()}|Events]}. diff --git a/deps/exmpp-0.9.9/src/network/exmpp_bosh.erl b/deps/exmpp-0.9.9/src/network/exmpp_bosh.erl index 27ee6c7c62a..8b91e6ac0cc 100644 --- a/deps/exmpp-0.9.9/src/network/exmpp_bosh.erl +++ b/deps/exmpp-0.9.9/src/network/exmpp_bosh.erl @@ -90,7 +90,7 @@ wping(_Pid) -> %% don't do anything on init. We establish the connection when the stream start %% is sent init([ClientPid, StreamRef, URL, Domain, Options]) -> - {A,B,C} = now(), + {A,B,C} = erlang:timestamp(), random:seed(A,B,C), Rid = 1000 + random:uniform(100000), ParsedUrl = parse_url(URL), diff --git a/deps/exmpp-0.9.9/src/network/exmpp_component.erl b/deps/exmpp-0.9.9/src/network/exmpp_component.erl index 649d93405ea..40d920e8bfa 100644 --- a/deps/exmpp-0.9.9/src/network/exmpp_component.erl +++ b/deps/exmpp-0.9.9/src/network/exmpp_component.erl @@ -153,7 +153,7 @@ set_controlling_process(Component,Client) when is_pid(Component), is_pid(Client) init([Pid]) -> inets:start(), exmpp_stringprep:start(), - {A1,A2,A3} = now(), + {A1,A2,A3} = erlang:timestamp(), random:seed(A1, A2, A3), {ok, setup, #state{client_pid=Pid}}. diff --git a/deps/exmpp-0.9.9/src/network/exmpp_dns.erl b/deps/exmpp-0.9.9/src/network/exmpp_dns.erl index d263ef53c6d..2d30d0b8cc8 100644 --- a/deps/exmpp-0.9.9/src/network/exmpp_dns.erl +++ b/deps/exmpp-0.9.9/src/network/exmpp_dns.erl @@ -153,7 +153,7 @@ get_s2s(Domain) -> %% Port = integer() get_servers(Service, Proto, Domain, DefaultPort) -> - {S1, S2, S3} = now(), + {S1, S2, S3} = erlang:timestamp(), random:seed(S1, S2, S3), Name = "_" ++ Service ++ "._" ++ Proto ++ "." ++ Domain, AddrList = case do_query(Name, Domain, DefaultPort) of diff --git a/deps/exmpp-0.9.9/src/network/exmpp_session.erl b/deps/exmpp-0.9.9/src/network/exmpp_session.erl index d585b5061d6..38bcaaa187c 100644 --- a/deps/exmpp-0.9.9/src/network/exmpp_session.erl +++ b/deps/exmpp-0.9.9/src/network/exmpp_session.erl @@ -409,7 +409,7 @@ init([Pid]) -> inets:start(), exmpp_stringprep:start(), - {A1,A2,A3} = now(), + {A1,A2,A3} = erlang:timestamp(), random:seed(A1, A2, A3), {ok, setup, #state{client_pid=Pid, stream_version = {0,0}}}; %%if not specified, do not use version 1.0 init([Pid, Version]) -> @@ -417,7 +417,7 @@ init([Pid, Version]) -> exmpp_stringprep:start(), exmpp_compress:start(), - {A1,A2,A3} = now(), + {A1,A2,A3} = erlang:timestamp(), random:seed(A1, A2, A3), {ok, setup, #state{client_pid=Pid, stream_version = Version}}. diff --git a/deps/ibrowse-4.0.1/src/ibrowse_http_client.erl b/deps/ibrowse-4.0.1/src/ibrowse_http_client.erl index 0c415031377..48ed442020d 100644 --- a/deps/ibrowse-4.0.1/src/ibrowse_http_client.erl +++ b/deps/ibrowse-4.0.1/src/ibrowse_http_client.erl @@ -425,7 +425,7 @@ accumulate_response(Data, #state{reply_buffer = RepBuf, make_tmp_filename(true) -> DownloadDir = ibrowse:get_config_value(download_dir, filename:absname("./")), - {A,B,C} = now(), + {A,B,C} = erlang:timestamp(), filename:join([DownloadDir, "ibrowse_tmp_file_"++ integer_to_list(A) ++ @@ -1805,7 +1805,7 @@ cancel_timer(Ref, {eat_message, Msg}) -> end. make_req_id() -> - now(). + erlang:timestamp(). to_lower(Str) -> to_lower(Str, []). diff --git a/deps/ibrowse-4.0.1/src/ibrowse_lib.erl b/deps/ibrowse-4.0.1/src/ibrowse_lib.erl index 1ce6bd4a288..ac609548fd6 100644 --- a/deps/ibrowse-4.0.1/src/ibrowse_lib.erl +++ b/deps/ibrowse-4.0.1/src/ibrowse_lib.erl @@ -368,7 +368,7 @@ default_port(ftp) -> 21. printable_date() -> {{Y,Mo,D},{H, M, S}} = calendar:local_time(), - {_,_,MicroSecs} = now(), + {_,_,MicroSecs} = erlang:timestamp(), [integer_to_list(Y), $-, integer_to_list(Mo), diff --git a/deps/ibrowse-4.0.1/src/ibrowse_test.erl b/deps/ibrowse-4.0.1/src/ibrowse_test.erl index d97f76c8fa4..88e8240c107 100644 --- a/deps/ibrowse-4.0.1/src/ibrowse_test.erl +++ b/deps/ibrowse-4.0.1/src/ibrowse_test.erl @@ -79,7 +79,7 @@ load_test(Url, NumWorkers, NumReqsPerWorker) when is_list(Url), proc_lib:spawn(?MODULE, send_reqs_1, [Url, NumWorkers, NumReqsPerWorker]). send_reqs_1(Url, NumWorkers, NumReqsPerWorker) -> - Start_time = now(), + Start_time = erlang:timestamp(), ets:new(pid_table, [named_table, public]), ets:new(ibrowse_test_results, [named_table, public]), ets:new(ibrowse_errors, [named_table, public, ordered_set]), @@ -89,7 +89,7 @@ send_reqs_1(Url, NumWorkers, NumReqsPerWorker) -> spawn_workers(Url, NumWorkers, NumReqsPerWorker), log_msg("Finished spawning workers...~n", []), do_wait(Url), - End_time = now(), + End_time = erlang:timestamp(), log_msg("All workers are done...~n", []), log_msg("ibrowse_test_results table: ~n~p~n", [ets:tab2list(ibrowse_test_results)]), log_msg("Start time: ~1000.p~n", [calendar:now_to_local_time(Start_time)]), @@ -167,7 +167,7 @@ do_send_req_1(Url, NumReqs) -> {error, retry_later} -> ets:update_counter(ibrowse_test_results, retry_later, 1); Err -> - ets:insert(ibrowse_errors, {now(), Err}), + ets:insert(ibrowse_errors, {erlang:timestamp(), Err}), ets:update_counter(ibrowse_test_results, other_error, 1), ok end, @@ -178,7 +178,7 @@ dump_errors() -> 0 -> ok; _ -> - {A, B, C} = now(), + {A, B, C} = erlang:timestamp(), Filename = lists:flatten( io_lib:format("ibrowse_errors_~p_~p_~p.txt" , [A, B, C])), case file:open(Filename, [write, delayed_write, raw]) of diff --git a/deps/mochiweb-2.4.2/src/mochiweb_acceptor.erl b/deps/mochiweb-2.4.2/src/mochiweb_acceptor.erl index efedfbdc556..892bcb93530 100644 --- a/deps/mochiweb-2.4.2/src/mochiweb_acceptor.erl +++ b/deps/mochiweb-2.4.2/src/mochiweb_acceptor.erl @@ -14,10 +14,10 @@ start_link(Server, Listen, Loop) -> proc_lib:spawn_link(?MODULE, init, [Server, Listen, Loop]). init(Server, Listen, Loop) -> - T1 = now(), + T1 = erlang:timestamp(), case catch mochiweb_socket:accept(Listen) of {ok, Socket} -> - gen_server:cast(Server, {accepted, self(), timer:now_diff(now(), T1)}), + gen_server:cast(Server, {accepted, self(), timer:now_diff(erlang:timestamp(), T1)}), call_loop(Loop, Socket); {error, closed} -> exit(normal); diff --git a/deps/nksip-0.4.0/include/nksip.hrl b/deps/nksip-0.4.0/include/nksip.hrl index d9ea543f34c..7ec4ffa5474 100644 --- a/deps/nksip-0.4.0/include/nksip.hrl +++ b/deps/nksip-0.4.0/include/nksip.hrl @@ -315,7 +315,7 @@ -define(TIMEOFF(Var), io:format("~s :: ~10.2f ms : ~p~n", [ string:copies(" ", length(erlang:get(debug_timer))), - (timer:now_diff(now(), hd(erlang:get(debug_timer)))/1000), Var + (timer:now_diff(erlang:timestamp(), hd(erlang:get(debug_timer)))/1000), Var ]), erlang:put(debug_timer, tl(erlang:get(debug_timer)))). -endif. diff --git a/deps/nksip-0.4.0/samples/nksip_loadtest/src/nksip_loadtest_lib.erl b/deps/nksip-0.4.0/samples/nksip_loadtest/src/nksip_loadtest_lib.erl index 6c23547be48..90eda39b354 100644 --- a/deps/nksip-0.4.0/samples/nksip_loadtest/src/nksip_loadtest_lib.erl +++ b/deps/nksip-0.4.0/samples/nksip_loadtest/src/nksip_loadtest_lib.erl @@ -204,10 +204,10 @@ launch(Opts) -> end end, empty(), - Start = now(), + Start = erlang:timestamp(), [proc_lib:spawn(fun() -> Fun(Pos) end) || Pos <- lists:seq(1, Processes)], Ok = wait(Total, 0), - Stop = now(); + Stop = erlang:timestamp(); full -> case NoAutoStart of true -> ok; @@ -220,10 +220,10 @@ launch(Opts) -> end, timer:sleep(100), empty(), - Start = now(), + Start = erlang:timestamp(), [proc_lib:spawn(fun() -> Fun(Pos) end) || Pos <- lists:seq(1, Processes)], Ok = wait(Total, 0), - Stop = now(), + Stop = erlang:timestamp(), case NoAutoStart of true -> ok; false -> ok = stop_clients(Processes) diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-erlang-client/test/test_util.erl b/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-erlang-client/test/test_util.erl index b6744236377..eb4c653ec4b 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-erlang-client/test/test_util.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-erlang-client/test/test_util.erl @@ -863,7 +863,7 @@ large_content_test() -> {ok, Channel} = amqp_connection:open_channel(Connection), #'queue.declare_ok'{queue = Q} = amqp_channel:call(Channel, #'queue.declare'{}), - {A1,A2,A3} = now(), random:seed(A1, A2, A3), + {A1,A2,A3} = erlang:timestamp(), random:seed(A1, A2, A3), F = list_to_binary([random:uniform(256)-1 || _ <- lists:seq(1, 1000)]), Payload = list_to_binary([[F || _ <- lists:seq(1, 1000)]]), Publish = #'basic.publish'{exchange = <<>>, routing_key = Q}, diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream.erl b/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream.erl index ae4c512d397..1be11188e71 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream.erl @@ -71,7 +71,7 @@ remove_credentials(URI) -> list_to_binary(amqp_uri:remove_credentials(binary_to_list(URI))). to_params(Upstream = #upstream{uris = URIs}, XorQ) -> - random:seed(now()), + random:seed(erlang:timestamp()), URI = lists:nth(random:uniform(length(URIs)), URIs), {ok, Params} = amqp_uri:parse(binary_to_list(URI), vhost(XorQ)), XorQ1 = with_name(Upstream, vhost(Params), XorQ), diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker.erl b/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker.erl index e5a8f638597..fa4e0b249d0 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker.erl @@ -54,7 +54,7 @@ handle_call(_Msg, _From, State) -> {noreply, State}. handle_cast(init, State = #state{config = Config}) -> - random:seed(now()), + random:seed(erlang:timestamp()), #shovel{sources = Sources, destinations = Destinations} = Config, {InboundConn, InboundChan, InboundURI} = make_conn_and_chan(Sources#endpoint.uris), diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/sockjs-erlang-wrapper/sockjs-erlang-git/src/sockjs_filters.erl b/deps/rabbitmq_server-3.5.5/plugins-src/sockjs-erlang-wrapper/sockjs-erlang-git/src/sockjs_filters.erl index fba43cc4891..d33d488f174 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/sockjs-erlang-wrapper/sockjs-erlang-git/src/sockjs_filters.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/sockjs-erlang-wrapper/sockjs-erlang-git/src/sockjs_filters.erl @@ -13,7 +13,7 @@ cache_for(Req, Headers) -> Expires = calendar:gregorian_seconds_to_datetime( calendar:datetime_to_gregorian_seconds( - calendar:now_to_datetime(now())) + ?YEAR), + calendar:now_to_datetime(erlang:timestamp())) + ?YEAR), H = [{"Cache-Control", "public, max-age=" ++ integer_to_list(?YEAR)}, {"Expires", httpd_util:rfc1123_date(Expires)}], {H ++ Headers, Req}. diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/sockjs-erlang-wrapper/sockjs-erlang-git/src/sockjs_util.erl b/deps/rabbitmq_server-3.5.5/plugins-src/sockjs-erlang-wrapper/sockjs-erlang-git/src/sockjs_util.erl index 9b9969dc7fa..ccf06db71c6 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/sockjs-erlang-wrapper/sockjs-erlang-git/src/sockjs_util.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/sockjs-erlang-wrapper/sockjs-erlang-git/src/sockjs_util.erl @@ -12,7 +12,7 @@ rand32() -> case get(random_seeded) of undefined -> - {MegaSecs, Secs, MicroSecs} = now(), + {MegaSecs, Secs, MicroSecs} = erlang:timestamp(), _ = random:seed(MegaSecs, Secs, MicroSecs), put(random_seeded, true); _Else -> diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine.erl b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine.erl index 2e5be1b8b06..1e3441b5555 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine.erl @@ -58,7 +58,7 @@ new_request(mochiweb, Request) -> {Peer, ReqState} = InitReq:get_peer(), PeerState = ReqState#wm_reqstate{reqdata=wrq:set_peer(Peer, ReqState#wm_reqstate.reqdata)}, - LogData = #wm_log_data{start_time=now(), + LogData = #wm_log_data{start_time=erlang:timestamp(), method=Method, headers=Headers, peer=PeerState#wm_reqstate.peer, diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_decision_core.erl b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_decision_core.erl index 33793880464..1f7cd1ac28a 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_decision_core.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_decision_core.erl @@ -63,7 +63,7 @@ respond(Code) when is_integer(Code) -> respond({Code, undefined}); respond({_, _}=CodeAndPhrase) -> Resource = get(resource), - EndTime = now(), + EndTime = erlang:timestamp(), respond(CodeAndPhrase, Resource, EndTime). respond({Code, _ReasonPhrase}=CodeAndPhrase, Resource, EndTime) @@ -104,7 +104,7 @@ error_response(Reason) -> error_response(Code, Reason) -> Resource = get(resource), - EndTime = now(), + EndTime = erlang:timestamp(), error_response({Code, undefined}, Reason, Resource, EndTime). error_response({Code, _}=CodeAndPhrase, Resource, EndTime) -> diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_request.erl b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_request.erl index ee459a3639c..545a9f33071 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_request.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_request.erl @@ -253,7 +253,7 @@ call({send_response, {Code, ReasonPhrase}=CodeAndReason}, Req) when is_integer(C send_response(CodeAndReason, Req) end, LogData = NewState#wm_reqstate.log_data, - NewLogData = LogData#wm_log_data{finish_time=now()}, + NewLogData = LogData#wm_log_data{finish_time=erlang:timestamp()}, {Reply, NewState#wm_reqstate{log_data=NewLogData}}; call(resp_body, {?MODULE, ReqState}) -> {wrq:resp_body(ReqState#wm_reqstate.reqdata), ReqState}; diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_resource.erl b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_resource.erl index a15fe76708a..482afb0d489 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_resource.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_resource.erl @@ -246,7 +246,7 @@ log_decision(File, DecisionID) -> io:format(File, "{decision, ~p}.~n", [DecisionID]). open_log_file(Dir, Mod) -> - Now = {_,_,US} = now(), + Now = {_,_,US} = erlang:timestamp(), {{Y,M,D},{H,I,S}} = calendar:now_to_universal_time(Now), Filename = io_lib:format( "~s/~p-~4..0B-~2..0B-~2..0B" diff --git a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_util.erl b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_util.erl index ab42b9d1c55..3c811f76c19 100644 --- a/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_util.erl +++ b/deps/rabbitmq_server-3.5.5/plugins-src/webmachine-wrapper/webmachine-git/src/webmachine_util.erl @@ -368,14 +368,14 @@ unescape_quoted_string([Char | Rest], Acc) -> unescape_quoted_string(Rest, [Char | Acc]). -%% @type now() = {MegaSecs, Secs, MicroSecs} +%% @type erlang:timestamp() = {MegaSecs, Secs, MicroSecs} %% This is faster than timer:now_diff() because it does not use bignums. %% But it returns *milliseconds* (timer:now_diff returns microseconds.) %% From http://www.erlang.org/ml-archive/erlang-questions/200205/msg00027.html -%% @doc Compute the difference between two now() tuples, in milliseconds. -%% @spec now_diff_milliseconds(now(), now()) -> integer() +%% @doc Compute the difference between two erlang:timestamp() tuples, in milliseconds. +%% @spec now_diff_milliseconds(erlang:timestamp(), erlang:timestamp()) -> integer() now_diff_milliseconds(undefined, undefined) -> 0; now_diff_milliseconds(undefined, T2) -> diff --git a/deps/rabbitmq_server-3.5.5/src/file_handle_cache.erl b/deps/rabbitmq_server-3.5.5/src/file_handle_cache.erl index d7e5abc8730..dfb3ce6e60e 100644 --- a/deps/rabbitmq_server-3.5.5/src/file_handle_cache.erl +++ b/deps/rabbitmq_server-3.5.5/src/file_handle_cache.erl @@ -536,7 +536,7 @@ clear(Ref) -> end). set_maximum_since_use(MaximumAge) -> - Now = now(), + Now = erlang:timestamp(), case lists:foldl( fun ({{Ref, fhc_handle}, Handle = #handle { hdl = Hdl, last_used_at = Then }}, Rep) -> @@ -708,7 +708,7 @@ get_or_reopen(RefNewOrReopens) -> {OpenHdls, []} -> {ok, [Handle || {_Ref, Handle} <- OpenHdls]}; {OpenHdls, ClosedHdls} -> - Oldest = oldest(get_age_tree(), fun () -> now() end), + Oldest = oldest(get_age_tree(), fun () -> erlang:timestamp() end), case gen_server2:call(?SERVER, {open, self(), length(ClosedHdls), Oldest}, infinity) of ok -> @@ -744,7 +744,7 @@ reopen([{Ref, NewOrReopen, Handle = #handle { hdl = closed, end, case prim_file:open(Path, Mode) of {ok, Hdl} -> - Now = now(), + Now = erlang:timestamp(), {{ok, _Offset}, Handle1} = maybe_seek(Offset, reset_read_buffer( Handle#handle{hdl = Hdl, @@ -780,7 +780,7 @@ sort_handles([{Ref, _} | RefHdls], RefHdlsA, [{Ref, Handle} | RefHdlsB], Acc) -> sort_handles(RefHdls, RefHdlsA, RefHdlsB, [Handle | Acc]). put_handle(Ref, Handle = #handle { last_used_at = Then }) -> - Now = now(), + Now = erlang:timestamp(), age_tree_update(Then, Now, Ref), put({Ref, fhc_handle}, Handle #handle { last_used_at = Now }). @@ -1419,7 +1419,7 @@ reduce(State = #fhc_state { open_pending = OpenPending, elders = Elders, clients = Clients, timer_ref = TRef }) -> - Now = now(), + Now = erlang:timestamp(), {CStates, Sum, ClientCount} = ets:foldl(fun ({Pid, Eldest}, {CStatesAcc, SumAcc, CountAcc} = Accs) -> [#cstate { pending_closes = PendingCloses, diff --git a/deps/rabbitmq_server-3.5.5/src/gen_server2.erl b/deps/rabbitmq_server-3.5.5/src/gen_server2.erl index ffc075da7f0..ae2f8afdd38 100644 --- a/deps/rabbitmq_server-3.5.5/src/gen_server2.erl +++ b/deps/rabbitmq_server-3.5.5/src/gen_server2.erl @@ -624,7 +624,7 @@ unregister_name(_Name) -> ok. extend_backoff(undefined) -> undefined; extend_backoff({backoff, InitialTimeout, MinimumTimeout, DesiredHibPeriod}) -> - {backoff, InitialTimeout, MinimumTimeout, DesiredHibPeriod, now()}. + {backoff, InitialTimeout, MinimumTimeout, DesiredHibPeriod, erlang:timestamp()}. %%%======================================================================== %%% Internal functions @@ -695,7 +695,7 @@ wake_hib(GS2State = #gs2_state { timeout_state = TS }) -> undefined -> undefined; {SleptAt, TimeoutState} -> - adjust_timeout_state(SleptAt, now(), TimeoutState) + adjust_timeout_state(SleptAt, erlang:timestamp(), TimeoutState) end, post_hibernate( drain(GS2State #gs2_state { timeout_state = TimeoutState1 })). @@ -703,7 +703,7 @@ wake_hib(GS2State = #gs2_state { timeout_state = TS }) -> hibernate(GS2State = #gs2_state { timeout_state = TimeoutState }) -> TS = case TimeoutState of undefined -> undefined; - {backoff, _, _, _, _} -> {now(), TimeoutState} + {backoff, _, _, _, _} -> {erlang:timestamp(), TimeoutState} end, proc_lib:hibernate(?MODULE, wake_hib, [GS2State #gs2_state { timeout_state = TS }]). diff --git a/deps/rabbitmq_server-3.5.5/src/gm.erl b/deps/rabbitmq_server-3.5.5/src/gm.erl index dbf9c295f94..16d87cc96f2 100644 --- a/deps/rabbitmq_server-3.5.5/src/gm.erl +++ b/deps/rabbitmq_server-3.5.5/src/gm.erl @@ -551,7 +551,7 @@ forget_group(GroupName) -> init([GroupName, Module, Args, TxnFun]) -> put(process_name, {?MODULE, GroupName}), - {MegaSecs, Secs, MicroSecs} = now(), + {MegaSecs, Secs, MicroSecs} = erlang:timestamp(), random:seed(MegaSecs, Secs, MicroSecs), Self = make_member(GroupName), gen_server2:cast(self(), join), diff --git a/deps/rabbitmq_server-3.5.5/src/rabbit_amqqueue_process.erl b/deps/rabbitmq_server-3.5.5/src/rabbit_amqqueue_process.erl index c5e4206fe36..6d10b6d28bb 100644 --- a/deps/rabbitmq_server-3.5.5/src/rabbit_amqqueue_process.erl +++ b/deps/rabbitmq_server-3.5.5/src/rabbit_amqqueue_process.erl @@ -803,7 +803,7 @@ stop(State) -> stop(noreply, State). stop(noreply, State) -> {stop, normal, State}; stop(Reply, State) -> {stop, normal, Reply, State}. -now_micros() -> timer:now_diff(now(), {0,0,0}). +now_micros() -> timer:now_diff(erlang:timestamp(), {0,0,0}). infos(Items, State) -> [{Item, i(Item, State)} || Item <- Items]. @@ -1306,7 +1306,7 @@ handle_pre_hibernate(State = #q{backing_queue = BQ, BQS3 = BQ:handle_pre_hibernate(BQS2), rabbit_event:if_enabled( State, #q.stats_timer, - fun () -> emit_stats(State, [{idle_since, now()}, + fun () -> emit_stats(State, [{idle_since, erlang:timestamp()}, {consumer_utilisation, ''}]) end), State1 = rabbit_event:stop_stats_timer(State#q{backing_queue_state = BQS3}, #q.stats_timer), diff --git a/deps/rabbitmq_server-3.5.5/src/rabbit_auth_backend_internal.erl b/deps/rabbitmq_server-3.5.5/src/rabbit_auth_backend_internal.erl index e53ce50c22d..c8b7dda1434 100644 --- a/deps/rabbitmq_server-3.5.5/src/rabbit_auth_backend_internal.erl +++ b/deps/rabbitmq_server-3.5.5/src/rabbit_auth_backend_internal.erl @@ -202,7 +202,7 @@ clear_password(Username) -> R. hash_password(Cleartext) -> - {A1,A2,A3} = now(), + {A1,A2,A3} = erlang:timestamp(), random:seed(A1, A2, A3), Salt = random:uniform(16#ffffffff), SaltBin = <>, diff --git a/deps/rabbitmq_server-3.5.5/src/rabbit_channel.erl b/deps/rabbitmq_server-3.5.5/src/rabbit_channel.erl index 489f7b34697..15106b9e795 100644 --- a/deps/rabbitmq_server-3.5.5/src/rabbit_channel.erl +++ b/deps/rabbitmq_server-3.5.5/src/rabbit_channel.erl @@ -468,7 +468,7 @@ handle_pre_hibernate(State) -> ok = clear_permission_cache(), rabbit_event:if_enabled( State, #ch.stats_timer, - fun () -> emit_stats(State, [{idle_since, now()}]) end), + fun () -> emit_stats(State, [{idle_since, erlang:timestamp()}]) end), {hibernate, rabbit_event:stop_stats_timer(State, #ch.stats_timer)}. terminate(Reason, State) -> diff --git a/deps/rabbitmq_server-3.5.5/src/rabbit_guid.erl b/deps/rabbitmq_server-3.5.5/src/rabbit_guid.erl index 193ca55e201..073723a8abc 100644 --- a/deps/rabbitmq_server-3.5.5/src/rabbit_guid.erl +++ b/deps/rabbitmq_server-3.5.5/src/rabbit_guid.erl @@ -84,7 +84,7 @@ fresh() -> %% We don't use erlang:timestamp() here because a) it may return %% duplicates when the system clock has been rewound prior to a %% restart, or ids were generated at a high rate (which causes - %% now() to move ahead of the system time), and b) it is really + %% erlang:timestamp() to move ahead of the system time), and b) it is really %% slow since it takes a global lock and makes a system call. %% %% A persisted serial number, the node, and a unique reference diff --git a/deps/rabbitmq_server-3.5.5/src/rabbit_mirror_queue_mode_exactly.erl b/deps/rabbitmq_server-3.5.5/src/rabbit_mirror_queue_mode_exactly.erl index 0c0b7a10e8b..5acece07591 100644 --- a/deps/rabbitmq_server-3.5.5/src/rabbit_mirror_queue_mode_exactly.erl +++ b/deps/rabbitmq_server-3.5.5/src/rabbit_mirror_queue_mode_exactly.erl @@ -45,7 +45,7 @@ suggested_queue_nodes(Count, MNode, SNodes, _SSNodes, Poss) -> end}. shuffle(L) -> - {A1,A2,A3} = now(), + {A1,A2,A3} = erlang:timestamp(), random:seed(A1, A2, A3), {_, L1} = lists:unzip(lists:keysort(1, [{random:uniform(), N} || N <- L])), L1. diff --git a/deps/rabbitmq_server-3.5.5/src/rabbit_misc.erl b/deps/rabbitmq_server-3.5.5/src/rabbit_misc.erl index ed5b38e815b..1aa74bc0441 100644 --- a/deps/rabbitmq_server-3.5.5/src/rabbit_misc.erl +++ b/deps/rabbitmq_server-3.5.5/src/rabbit_misc.erl @@ -805,7 +805,7 @@ gb_trees_foreach(Fun, Tree) -> gb_trees_fold(fun (Key, Val, Acc) -> Fun(Key, Val), Acc end, ok, Tree). now_ms() -> - timer:now_diff(now(), {0,0,0}) div 1000. + timer:now_diff(erlang:timestamp(), {0,0,0}) div 1000. module_attributes(Module) -> case catch Module:module_info(attributes) of diff --git a/deps/rabbitmq_server-3.5.5/src/rabbit_queue_consumers.erl b/deps/rabbitmq_server-3.5.5/src/rabbit_queue_consumers.erl index ae8481aaf8a..d0c49bc2575 100644 --- a/deps/rabbitmq_server-3.5.5/src/rabbit_queue_consumers.erl +++ b/deps/rabbitmq_server-3.5.5/src/rabbit_queue_consumers.erl @@ -465,4 +465,4 @@ use_avg(Active, Inactive, Avg) -> Time = Inactive + Active, rabbit_misc:moving_average(Time, ?USE_AVG_HALF_LIFE, Active / Time, Avg). -now_micros() -> timer:now_diff(now(), {0,0,0}). +now_micros() -> timer:now_diff(erlang:timestamp(), {0,0,0}). diff --git a/deps/rabbitmq_server-3.5.5/src/rabbit_variable_queue.erl b/deps/rabbitmq_server-3.5.5/src/rabbit_variable_queue.erl index 8038791dc35..e5774ae1d97 100644 --- a/deps/rabbitmq_server-3.5.5/src/rabbit_variable_queue.erl +++ b/deps/rabbitmq_server-3.5.5/src/rabbit_variable_queue.erl @@ -1122,7 +1122,7 @@ init(IsDurable, IndexState, DeltaCount, DeltaBytes, Terms, count = DeltaCount1, end_seq_id = NextSeqId }) end, - Now = now(), + Now = erlang:timestamp(), IoBatchSize = rabbit_misc:get_env(rabbit, msg_store_io_batch_size, ?IO_BATCH_SIZE), diff --git a/deps/rabbitmq_server-3.5.5/src/time_compat.erl b/deps/rabbitmq_server-3.5.5/src/time_compat.erl index 64b11f7aef4..56cc9ccb222 100644 --- a/deps/rabbitmq_server-3.5.5/src/time_compat.erl +++ b/deps/rabbitmq_server-3.5.5/src/time_compat.erl @@ -198,7 +198,7 @@ unique_integer(Modifiers) -> error:undef -> case is_valid_modifier_list(Modifiers) of true -> - %% now() converted to an integer + %% erlang:timestamp() converted to an integer %% fullfill the requirements of %% all modifiers: unique, positive, %% and monotonic... diff --git a/deps/socketio-0.1.0/src/uuids.erl b/deps/socketio-0.1.0/src/uuids.erl index 5d744154241..e7d855b52c0 100644 --- a/deps/socketio-0.1.0/src/uuids.erl +++ b/deps/socketio-0.1.0/src/uuids.erl @@ -38,7 +38,7 @@ random() -> list_to_binary(to_hex(crypto:rand_bytes(16))). utc_random() -> - Now = {_, _, Micro} = now(), + Now = {_, _, Micro} = erlang:timestamp(), Nowish = calendar:now_to_universal_time(Now), Nowsecs = calendar:datetime_to_gregorian_seconds(Nowish), Then = calendar:datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}}), diff --git a/scripts/update-the-types.sh b/scripts/update-the-types.sh index bd053847486..50f1b221963 100755 --- a/scripts/update-the-types.sh +++ b/scripts/update-the-types.sh @@ -7,18 +7,21 @@ ROOT=`pwd -P`/.. EXCLUDES="merl.erl" echo "Looking at $ROOT" +rm -f $ROOT/sar.txt function SaRF { - SEARCH=$1 - REPLACE=$2 - FILE=$3 - PREFIX=$4 + #SEARCH=$1 + #REPLACE=$2 + #FILE=$3 + #PREFIX=$4 + + echo "'$4' '$1' '$2' in $3" >> $ROOT/sar.txt case ${FILE##*.} in erl ) - sed -i "s/$PREFIX$SEARCH/$PREFIX$REPLACE/g" $FILE ;; + sed -i "s/$4$1/$4$2/g" $3 ;; hrl ) - sed -i "s/$PREFIX$SEARCH/$PREFIX$REPLACE/g" $FILE ;; + sed -i "s/$4$1/$4$2/g" $3 ;; esac } @@ -26,9 +29,13 @@ function SaR { SEARCH=$1 REPLACE=$2 - for PREFIX in " " "(" "{" "="; do + ## declare an array variable + declare -a prefixes=(" " "(" "{" "=") + + ## now loop through the above array + for PREFIX in "${prefixes[@]}"; do for FILE in `grep -lr "$PREFIX$SEARCH" $ROOT/{core,applications,deps} --exclude=$EXCLUDES`; do - SaRF $SEARCH $REPLACE $FILE $PREFIX + SaRF $SEARCH $REPLACE $FILE "$PREFIX" done done } @@ -60,14 +67,17 @@ SaR "set()" "sets:set()" echo "replacing erlang:now()" SaR "erlang:now" "erlang:timestamp" -echo "replacing RabbitMQ ?QUEUE()" -SaR "?QUEUE()" "queue:queue()" +echo "replacing raw now()" +SaR "now()" "erlang:timestamp()" + +# echo "replacing RabbitMQ ?QUEUE()" +# SaR "?QUEUE()" "queue:queue()" -echo "replacing RabbitMQ ?DICT()" -SaR "?DICT()" "dict:dict()" +# echo "replacing RabbitMQ ?DICT()" +# SaR "?DICT()" "dict:dict()" -echo "replacing RabbitMQ ?SET()" -SaR "?SET()" "sets:set()" +# echo "replacing RabbitMQ ?SET()" +# SaR "?SET()" "sets:set()" echo "replacing apns Queue::queue()" SaRF "Queue::queue()" "Queue::queue:queue()" "$ROOT/applications/pusher/lib/apns/src/apns_queue.erl" ""