aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-04-17 16:24:25 +0200
committerMicael Karlberg <[email protected]>2019-04-17 16:24:25 +0200
commitdbe9bbfb801bcd92cc54c73ce96203b3a04c5517 (patch)
tree3322a7972facee352712552a2bb968cb4c35c22a
parent2587405769912b165b4c97d827411db09d7a7882 (diff)
parentfaa6a36586dd1fe8a3a6bb2507c9b02781b4d386 (diff)
downloadotp-dbe9bbfb801bcd92cc54c73ce96203b3a04c5517.tar.gz
otp-dbe9bbfb801bcd92cc54c73ce96203b3a04c5517.tar.bz2
otp-dbe9bbfb801bcd92cc54c73ce96203b3a04c5517.zip
Merge branch 'bmk/20190415/fix_timestamp_type'
-rw-r--r--lib/snmp/src/misc/snmp_misc.erl22
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/snmp/src/misc/snmp_misc.erl b/lib/snmp/src/misc/snmp_misc.erl
index 0cc04d4056..39254503ac 100644
--- a/lib/snmp/src/misc/snmp_misc.erl
+++ b/lib/snmp/src/misc/snmp_misc.erl
@@ -151,41 +151,41 @@ formated_long_timestamp() ->
%% the date in the formatted timestamp.
%% ---------------------------------------------------------------------------
--spec format_timestamp(Now :: os:timestamp()) ->
+-spec format_timestamp(Now :: erlang:timestamp()) ->
string().
format_timestamp(Now) ->
format_long_timestamp(Now).
--spec format_short_timestamp(Now :: os:timestamp()) ->
+-spec format_short_timestamp(Now :: erlang:timestamp()) ->
string().
format_short_timestamp(Now) ->
N2T = fun(N) -> calendar:now_to_local_time(N) end,
format_timestamp(short, Now, N2T).
--spec format_long_timestamp(Now :: os:timestamp()) ->
+-spec format_long_timestamp(Now :: erlang:timestamp()) ->
string().
format_long_timestamp(Now) ->
N2T = fun(N) -> calendar:now_to_local_time(N) end,
format_timestamp(long, Now, N2T).
--spec format_timestamp(Now :: os:timestamp(),
+-spec format_timestamp(Now :: erlang:timestamp(),
N2T :: function()) ->
string().
format_timestamp(Now, N2T) when is_tuple(Now) andalso is_function(N2T) ->
format_long_timestamp(Now, N2T).
--spec format_short_timestamp(Now :: os:timestamp(),
+-spec format_short_timestamp(Now :: erlang:timestamp(),
N2T :: function()) ->
string().
format_short_timestamp(Now, N2T) when is_tuple(Now) andalso is_function(N2T) ->
format_timestamp(short, Now, N2T).
--spec format_long_timestamp(Now :: os:timestamp(),
+-spec format_long_timestamp(Now :: erlang:timestamp(),
N2T :: function()) ->
string().
@@ -195,14 +195,8 @@ format_long_timestamp(Now, N2T) when is_tuple(Now) andalso is_function(N2T) ->
format_timestamp(Format, {_N1, _N2, N3} = Now, N2T) ->
{Date, Time} = N2T(Now),
do_format_timestamp(Format, Date, Time, N3).
- %% case Format of
- %% short ->
- %% do_format_short_timestamp(Time, N3);
- %% long ->
- %% do_format_long_timestamp(Date, Time, N3)
- %% end.
-
-do_format_timestamp(short, Date, Time, N3) ->
+
+do_format_timestamp(short, _Date, Time, N3) ->
do_format_short_timestamp(Time, N3);
do_format_timestamp(long, Date, Time, N3) ->
do_format_long_timestamp(Date, Time, N3).