Skip to content

Commit 7c84a5c

Browse files
authored
Use System.system_time/1 consistently (#1280)
1 parent b8a4b46 commit 7c84a5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/plug/upload.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ defmodule Plug.Upload do
116116

117117
defp generate_tmp_dir() do
118118
{tmp_roots, suffix} = :persistent_term.get(__MODULE__)
119-
{mega, _, _} = :os.timestamp()
120-
subdir = "/plug-" <> i(mega) <> "-" <> suffix
119+
sec = System.system_time(:second) |> div(1024 * 1024)
120+
subdir = "/plug-" <> i(sec) <> "-" <> suffix
121121

122122
if tmp = Enum.find_value(tmp_roots, &make_tmp_dir(&1 <> subdir)) do
123123
{:ok, tmp}
@@ -151,7 +151,7 @@ defmodule Plug.Upload do
151151
end
152152

153153
defp path(prefix, tmp) do
154-
sec = :os.system_time(:second)
154+
sec = System.system_time(:second)
155155
rand = :rand.uniform(999_999_999_999)
156156
scheduler_id = :erlang.system_info(:scheduler_id)
157157
tmp <> "/" <> prefix <> "-" <> i(sec) <> "-" <> i(rand) <> "-" <> i(scheduler_id)

0 commit comments

Comments
 (0)