Browse Source

Eliminate unix_timestamp/1, unix_epoch/0, and unix_seconds/1

Tim Fletcher 11 years ago
parent
commit
a7715f4412
1 changed files with 3 additions and 10 deletions
  1. 3 10
      src/oauth.erl

+ 3 - 10
src/oauth.erl

@@ -191,17 +191,10 @@ params_decode(_Response={{_, _, _}, _, Body}) ->
 http_request(Method, Request, Options) ->
   httpc:request(Method, Request, [{autoredirect, false}], Options).
 
-unix_timestamp() ->
-  unix_timestamp(calendar:universal_time()).
-
-unix_timestamp(DateTime) ->
-  unix_seconds(DateTime) - unix_epoch().
+-define(unix_epoch, 62167219200).
 
-unix_epoch() ->
-  unix_seconds({{1970,1,1},{00,00,00}}).
-
-unix_seconds(DateTime) ->
-  calendar:datetime_to_gregorian_seconds(DateTime).
+unix_timestamp() ->
+  calendar:datetime_to_gregorian_seconds(calendar:universal_time()) - ?unix_epoch.
 
 read_cert_key(Path) when is_list(Path) ->
   {ok, Contents} = file:read_file(Path),