diff options
Diffstat (limited to 'src/erlang-oauth/oauth_unix.erl')
-rw-r--r-- | src/erlang-oauth/oauth_unix.erl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/erlang-oauth/oauth_unix.erl b/src/erlang-oauth/oauth_unix.erl new file mode 100644 index 00000000..73ca3143 --- /dev/null +++ b/src/erlang-oauth/oauth_unix.erl @@ -0,0 +1,16 @@ +-module(oauth_unix). + +-export([timestamp/0]). + + +timestamp() -> + timestamp(calendar:universal_time()). + +timestamp(DateTime) -> + seconds(DateTime) - epoch(). + +epoch() -> + seconds({{1970,1,1},{00,00,00}}). + +seconds(DateTime) -> + calendar:datetime_to_gregorian_seconds(DateTime). |