Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated now #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/examples/sample_mc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ success() ->
%%% INIT/TERMINATE EXPORTS
%%%-----------------------------------------------------------------------------
init([Silent]) ->
{A1, A2, A3} = now(),
{A1, A2, A3} = erlang:timestamp(),
random:seed(A1, A2, A3),
{ok, #st{silent = Silent}}.

Expand Down
4 changes: 2 additions & 2 deletions doc/smpp_disk_log_hlr.ndoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ This module implements the ``gen_event`` behaviour.
= DESCRIPTION =

The ``disk_log_hlr`` stores SMPP PDUs on disk in tuples with the format
``{Now, Format(Pdu)}``. ``Now`` is the timestamp as returned by the
BIF ``now()``. ``Pdu`` is the SMPP PDU in binary format and ``Format`` is the
``{Timestamp, Format(Pdu)}``. ``Now`` is the timestamp as returned by the
BIF ``erlang:timestamp()``. ``Pdu`` is the SMPP PDU in binary format and ``Format`` is the
formatting fun.

The format of the term stored by the disk log can be redefined using a custom
Expand Down
4 changes: 2 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

{erl_opts, [warnings_as_errors, debug_info]}.

{deps, [{common_lib, "3.3.4",
{git, "git://github.com/iamaleksey/common_lib.git", {tag, "3.3.4"}}}]}.
{deps, [{common_lib, "3.3.5",
{git, "git://github.com/iamaleksey/common_lib.git", {tag, "3.3.5"}}}]}.

{erl_first_files, ["src/gen_esme_session.erl",
"src/gen_mc_session.erl",
Expand Down
4 changes: 1 addition & 3 deletions src/smpp_disk_log_hlr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ handle_call(Req, St) ->
handle_event({pdu, Pdu}, St) ->
case catch (St#st.filter)(Pdu) of
true ->
disk_log:alog(St#st.name, {now(), (St#st.format)(Pdu)});
disk_log:alog(St#st.name, {erlang:timestamp(), (St#st.format)(Pdu)});
_Otherwise ->
ok
end,
Expand Down Expand Up @@ -180,5 +180,3 @@ init_st(Args) ->

merge_args(Args1, Args2) ->
cl_lists:ukeymerge(1, lists:keysort(1, Args1), lists:keysort(1, Args2)).


2 changes: 1 addition & 1 deletion src/smpp_param.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
%% destination_addr
%%
%% %@doc Specifies the destination SME address. For mobile terminated
%% messages, this is the directory number of the recipient MS. IP addresses
%% messages, this is the directory number of the recipient MS. IP addresses ç
%% are specified in "aaa.bbb.ccc.ddd" notation. C-Octet String, Var. max 21
%% octets.
%% %@end
Expand Down
8 changes: 4 additions & 4 deletions src/smpp_session.erl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
%% instant congestion state value is calculated. Notice this value cannot be
%% greater than 99.
congestion(CongestionSt, WaitTime, Timestamp) ->
case (timer:now_diff(now(), Timestamp) div (WaitTime + 1)) * 85 of
case (timer:now_diff(erlang:timestamp(), Timestamp) div (WaitTime + 1)) * 85 of
Val when Val < 1 ->
0;
Val when Val > 99 -> % Out of bounds
Expand Down Expand Up @@ -161,11 +161,11 @@ wait_recv(Pid, Sock, Log) ->


recv_loop(Pid, Sock, Buffer, Log) ->
Timestamp = now(),
Timestamp = erlang:timestamp(),
inet:setopts(Sock, [{active, once}]),
receive
{tcp, Sock, Input} ->
L = timer:now_diff(now(), Timestamp),
L = timer:now_diff(erlang:timestamp(), Timestamp),
B = handle_input(Pid, list_to_binary([Buffer, Input]), L, 1, Log),
?MODULE:recv_loop(Pid, Sock, B, Log);
{tcp_closed, Sock} ->
Expand Down Expand Up @@ -223,7 +223,7 @@ handle_accept(Pid, Sock) ->


handle_input(Pid, <<CmdLen:32, Rest/binary>> = Buffer, Lapse, N, Log) ->
Now = now(), % PDU received. PDU handling starts now!
Now = erlang:timestamp(), % PDU received. PDU handling starts now!
Len = CmdLen - 4,
case Rest of
<<PduRest:Len/binary-unit:8, NextPdus/binary>> ->
Expand Down
2 changes: 1 addition & 1 deletion test/gen_esme_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ suite() ->
%% @end
init_per_suite(Conf) ->
lists:foreach(fun(X) -> code:add_path(X) end, ct:get_config(paths, [])),
{A1, A2, A3} = now(),
{A1, A2, A3} = erlang:timestamp(),
random:seed(A1, A2, A3),
application:start(common_lib),
dbg:tracer(),
Expand Down
2 changes: 1 addition & 1 deletion test/gen_mc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ suite() ->
%%%-----------------------------------------------------------------------------
init_per_suite(Conf) ->
lists:foreach(fun(X) -> code:add_path(X) end, ct:get_config(paths, [])),
{A1, A2, A3} = now(),
{A1, A2, A3} = erlang:timestamp(),
random:seed(A1, A2, A3),
application:start(common_lib),
dbg:tracer(),
Expand Down
2 changes: 1 addition & 1 deletion test/log_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ suite() ->
%%%-----------------------------------------------------------------------------
init_per_suite(Conf) ->
lists:foreach(fun(X) -> code:add_path(X) end, ct:get_config(paths, [])),
{A1, A2, A3} = now(),
{A1, A2, A3} = erlang:timestamp(),
random:seed(A1, A2, A3),
dbg:tracer(),
dbg:p(all, [c, sos, sol]),
Expand Down
2 changes: 1 addition & 1 deletion test/operation_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ suite() ->
%%%-----------------------------------------------------------------------------
init_per_suite(Conf) ->
lists:foreach(fun(X) -> code:add_path(X) end, ct:get_config(paths, [])),
{A1, A2, A3} = now(),
{A1, A2, A3} = erlang:timestamp(),
random:seed(A1, A2, A3),
dbg:tracer(),
dbg:p(all, [c, sos, sol]),
Expand Down
2 changes: 1 addition & 1 deletion test/test_mc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ success() ->
%%% INIT/TERMINATE EXPORTS
%%%-----------------------------------------------------------------------------
init([Silent]) ->
{A1, A2, A3} = now(),
{A1, A2, A3} = erlang:timestamp(),
random:seed(A1, A2, A3),
{ok, #st{silent = Silent}}.

Expand Down