summaryrefslogtreecommitdiff
path: root/src/jlib.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2016-11-24 15:06:06 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2016-11-24 15:06:06 +0300
commit49f1275e2005c8bce2fdcad8499f4fad94a9d768 (patch)
tree6a59368ac3f94d6e03f80694bf80dbf502f8e07a /src/jlib.erl
parentAdd missing -callbacks (diff)
Get rid of excessive (io)list_to_binary/1 calls
Diffstat (limited to 'src/jlib.erl')
-rw-r--r--src/jlib.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jlib.erl b/src/jlib.erl
index f7dbebd8..096ef401 100644
--- a/src/jlib.erl
+++ b/src/jlib.erl
@@ -677,14 +677,14 @@ timestamp_to_iso({{Year, Month, Day},
%% http://xmpp.org/extensions/xep-0091.html#time
timestamp_to_legacy({{Year, Month, Day},
{Hour, Minute, Second}}) ->
- iolist_to_binary(io_lib:format("~4..0B~2..0B~2..0BT~2..0B:~2..0B:~2..0B",
+ (str:format("~4..0B~2..0B~2..0BT~2..0B:~2..0B:~2..0B",
[Year, Month, Day, Hour, Minute, Second])).
-spec timestamp_to_iso_basic(calendar:datetime()) -> binary().
%% This is the ISO 8601 basic bormat
timestamp_to_iso_basic({{Year, Month, Day},
{Hour, Minute, Second}}) ->
- iolist_to_binary(io_lib:format("~4..0B~2..0B~2..0BT~2..0B~2..0B~2..0B",
+ (str:format("~4..0B~2..0B~2..0BT~2..0B~2..0B~2..0B",
[Year, Month, Day, Hour, Minute, Second])).
-spec now_to_utc_string(erlang:timestamp()) -> binary().
@@ -703,7 +703,7 @@ now_to_utc_string({MegaSecs, Secs, MicroSecs}, Precision) ->
Max ->
now_to_utc_string({MegaSecs, Secs + 1, 0}, Precision);
FracOfSec ->
- list_to_binary(io_lib:format("~4..0B-~2..0B-~2..0BT"
+ (str:format("~4..0B-~2..0B-~2..0BT"
"~2..0B:~2..0B:~2..0B.~*..0BZ",
[Year, Month, Day, Hour, Minute, Second,
Precision, FracOfSec]))
@@ -725,7 +725,7 @@ now_to_local_string({MegaSecs, Secs, MicroSecs}) ->
end,
{{Year, Month, Day}, {Hour, Minute, Second}} =
LocalTime,
- list_to_binary(io_lib:format("~4..0B-~2..0B-~2..0BT~2..0B:~2..0B:~2..0B.~6."
+ (str:format("~4..0B-~2..0B-~2..0BT~2..0B:~2..0B:~2..0B.~6."
".0B~s~2..0B:~2..0B",
[Year, Month, Day, Hour, Minute, Second,
MicroSecs, Sign, H, M])).