Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v0.2.2
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (16 sloc) 0.706 kb
%% @doc Timestamp functions for <code>statebox:new/1</code> and
%% <code>statebox:modify/2</code>.
-export([timestamp/0, now_to_msec/1]).
-define(KILO, 1000).
-define(MEGA, 1000000).
%% @doc Current UNIX epoch timestamp in integer milliseconds.
%% Equivalient to <code>now_to_msec(os:timestamp())</code>.
-spec timestamp() -> integer().
timestamp() ->
%% @doc Converts given time of now() format to UNIX epoch timestamp in
%% integer milliseconds.
-spec now_to_msec({integer(), integer(), integer()}) -> integer().
now_to_msec({MegaSecs, Secs, MicroSecs}) ->
trunc(((MegaSecs * ?MEGA) + Secs + (MicroSecs / ?MEGA)) * ?KILO).
Jump to Line
Something went wrong with that request. Please try again.