Skip to content

Instantly share code, notes, and snippets.

@DimitryDushkin
Created May 7, 2013 12:01
Show Gist options
  • Save DimitryDushkin/5532071 to your computer and use it in GitHub Desktop.
Save DimitryDushkin/5532071 to your computer and use it in GitHub Desktop.
Erlang get current time in milliseconds
-spec get_timestamp() -> integer().
get_timestamp() ->
{Mega, Sec, Micro} = os:timestamp(),
(Mega*1000000 + Sec)*1000 + round(Micro/1000).
@deverlex
Copy link

thanks

@dylan-chong
Copy link

Thanks @joakimk . :erlang.system_time / 1.0e6 |> round works to get the millis

@bartekupartek
Copy link

there is Erlang function to get timestamp in ms :os.system_time(:millisecond)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment