aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_pkix.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2019-09-20 15:33:08 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2019-09-20 15:33:08 +0300
commit81ae691738c2ed78a1ab0b4b97655a42344a3b77 (patch)
tree2df174765bf281310d6f741a3d42577bd9588150 /src/ejabberd_pkix.erl
parentFix typo (diff)
Use round/0 instead of ceil/0
Because ceil/0 was introduced in OTP20.0 only
Diffstat (limited to 'src/ejabberd_pkix.erl')
-rw-r--r--src/ejabberd_pkix.erl16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ejabberd_pkix.erl b/src/ejabberd_pkix.erl
index efe2ffe9b..48d1a5d6c 100644
--- a/src/ejabberd_pkix.erl
+++ b/src/ejabberd_pkix.erl
@@ -417,12 +417,12 @@ time_before_expiration(Expiry) ->
calendar:now_to_datetime(erlang:timestamp())),
Secs = max(0, T1 - T2),
if Secs == {0, ""};
- Secs >= 220752000 -> {ceil(Secs/220752000), "year"};
- Secs >= 2592000 -> {ceil(Secs/2592000), "month"};
- Secs >= 604800 -> {ceil(Secs/604800), "week"};
- Secs >= 86400 -> {ceil(Secs/86400), "day"};
- Secs >= 3600 -> {ceil(Secs/3600), "hour"};
- Secs >= 60 -> {ceil(Secs/60), "minute"};
+ Secs >= 220752000 -> {round(Secs/220752000), "year"};
+ Secs >= 2592000 -> {round(Secs/2592000), "month"};
+ Secs >= 604800 -> {round(Secs/604800), "week"};
+ Secs >= 86400 -> {round(Secs/86400), "day"};
+ Secs >= 3600 -> {round(Secs/3600), "hour"};
+ Secs >= 60 -> {round(Secs/60), "minute"};
true -> {Secs, "second"}
end.
@@ -430,8 +430,8 @@ time_before_expiration(Expiry) ->
format_expiration_date(DateTime) ->
case time_before_expiration(DateTime) of
{0, _} -> "is expired";
- {1, Unit} -> "will expire in less than a " ++ Unit;
+ {1, Unit} -> "will expire in a " ++ Unit;
{Int, Unit} ->
- "will expire in less than " ++ integer_to_list(Int)
+ "will expire in " ++ integer_to_list(Int)
++ " " ++ Unit ++ "s"
end.