aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_clock.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-03-27 11:16:24 +0100
committerLoïc Hoguin <[email protected]>2014-03-27 11:30:44 +0100
commitc9b9644aa3020643051da73931542367d649f593 (patch)
tree5e8d739849e1b55306a7c7e2eec2238ce0ebb4eb /src/cowboy_clock.erl
parent17af50812c47f5dec7e02e443c551b9697715729 (diff)
downloadcowboy-c9b9644aa3020643051da73931542367d649f593.tar.gz
cowboy-c9b9644aa3020643051da73931542367d649f593.tar.bz2
cowboy-c9b9644aa3020643051da73931542367d649f593.zip
Add +warn_missing_spec and fix specs
Diffstat (limited to 'src/cowboy_clock.erl')
-rw-r--r--src/cowboy_clock.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cowboy_clock.erl b/src/cowboy_clock.erl
index a8de9bb..2de3470 100644
--- a/src/cowboy_clock.erl
+++ b/src/cowboy_clock.erl
@@ -59,6 +59,7 @@ rfc1123(DateTime) ->
%% gen_server.
+-spec init([]) -> {ok, #state{}}.
init([]) ->
?MODULE = ets:new(?MODULE, [set, protected,
named_table, {read_concurrency, true}]),
@@ -68,15 +69,20 @@ init([]) ->
ets:insert(?MODULE, {rfc1123, B}),
{ok, #state{universaltime=T, rfc1123=B, tref=TRef}}.
+-spec handle_call(any(), _, State)
+ -> {reply, ignored, State} | {stop, normal, stopped, State}
+ when State::#state{}.
handle_call(stop, _From, State=#state{tref=TRef}) ->
{ok, cancel} = timer:cancel(TRef),
{stop, normal, stopped, State};
handle_call(_Request, _From, State) ->
{reply, ignored, State}.
+-spec handle_cast(_, State) -> {noreply, State} when State::#state{}.
handle_cast(_Msg, State) ->
{noreply, State}.
+-spec handle_info(any(), State) -> {noreply, State} when State::#state{}.
handle_info(update, #state{universaltime=Prev, rfc1123=B1, tref=TRef}) ->
T = erlang:universaltime(),
B2 = update_rfc1123(B1, Prev, T),
@@ -85,9 +91,11 @@ handle_info(update, #state{universaltime=Prev, rfc1123=B1, tref=TRef}) ->
handle_info(_Info, State) ->
{noreply, State}.
+-spec terminate(_, _) -> ok.
terminate(_Reason, _State) ->
ok.
+-spec code_change(_, State, _) -> {ok, State} when State::#state{}.
code_change(_OldVsn, State, _Extra) ->
{ok, State}.