summaryrefslogtreecommitdiff
path: root/src/erlang-oauth/oauth_unix.erl
blob: 73ca3143e905303d13c0d5fd92927d97368c1a5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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).