Add function specs
This commit is contained in:
parent
609f442ea9
commit
89b03eb9a6
|
@ -34,15 +34,19 @@
|
||||||
seed() ->
|
seed() ->
|
||||||
rand:seed(exsplus, erlang:timestamp()).
|
rand:seed(exsplus, erlang:timestamp()).
|
||||||
|
|
||||||
|
-spec(now_secs() -> pos_integer()).
|
||||||
now_secs() ->
|
now_secs() ->
|
||||||
erlang:system_time(second).
|
erlang:system_time(second).
|
||||||
|
|
||||||
|
-spec(now_secs(erlang:timestamp()) -> pos_integer()).
|
||||||
now_secs({MegaSecs, Secs, _MicroSecs}) ->
|
now_secs({MegaSecs, Secs, _MicroSecs}) ->
|
||||||
MegaSecs * 1000000 + Secs.
|
MegaSecs * 1000000 + Secs.
|
||||||
|
|
||||||
|
-spec(now_ms() -> pos_integer()).
|
||||||
now_ms() ->
|
now_ms() ->
|
||||||
erlang:system_time(millisecond).
|
erlang:system_time(millisecond).
|
||||||
|
|
||||||
|
-spec(now_ms(erlang:timestamp()) -> pos_integer()).
|
||||||
now_ms({MegaSecs, Secs, MicroSecs}) ->
|
now_ms({MegaSecs, Secs, MicroSecs}) ->
|
||||||
(MegaSecs * 1000000 + Secs) * 1000 + round(MicroSecs/1000).
|
(MegaSecs * 1000000 + Secs) * 1000 + round(MicroSecs/1000).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue