summaryrefslogtreecommitdiff
path: root/src/plop_compat.erl
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2016-09-15 16:26:52 +0200
committerLinus Nordberg <linus@nordu.net>2016-09-15 16:26:52 +0200
commite51588399d15cde7ee283e1f72f99ddefa60f83d (patch)
tree5b020344edf81dba85c01a23a794ac3229c44a28 /src/plop_compat.erl
parentc97d320d17d9c72a4daa620a43745b7aca3a9bde (diff)
Don't use erlang:timestamp/0 on R17.
Diffstat (limited to 'src/plop_compat.erl')
-rw-r--r--src/plop_compat.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plop_compat.erl b/src/plop_compat.erl
index d9f3620..d59edf0 100644
--- a/src/plop_compat.erl
+++ b/src/plop_compat.erl
@@ -1,9 +1,12 @@
-module(plop_compat).
--export([unpack_spki/1]).
+-export([unpack_spki/1, timestamp/0]).
-include_lib("public_key/include/public_key.hrl").
unpack_spki(SPKI) ->
unpack_spki(erlang:system_info(otp_release), SPKI).
+timestamp() ->
+ timestamp(erlang:system_info(otp_release)).
+
unpack_spki("17", SPKI) ->
#'SubjectPublicKeyInfo'{subjectPublicKey = {_, Octets},
@@ -13,3 +16,9 @@ unpack_spki("18", SPKI) ->
#'SubjectPublicKeyInfo'{subjectPublicKey = Octets,
algorithm = Algorithm} = SPKI,
{Octets, Algorithm}.
+
+%% <=R17: now/0, >=R18 timestamp/0
+timestamp("17") ->
+ erlang:now();
+timestamp("18") ->
+ erlang:timestamp().