Skip to content

Instantly share code, notes, and snippets.

@frenchbread
Created October 11, 2016 23:48
Show Gist options
  • Save frenchbread/7dbc6d46c7e2b77305d90ebbe662e644 to your computer and use it in GitHub Desktop.
Save frenchbread/7dbc6d46c7e2b77305d90ebbe662e644 to your computer and use it in GitHub Desktop.
Some code from emqttd
-spec get_timestamp() -> integer().
get_timestamp() ->
{Mega, Sec, Micro} = os:timestamp(),
(Mega*1000000 + Sec)*1000 + round(Micro/1000).
tuple_to_string(Req) ->
Timestamp = get_timestamp(),
{_,[_,Method,Path|Rest]} = Req,
Bucket = [Timestamp,{Method,Path}],
lists:flatten(io_lib:format("~p", [Bucket])).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment