Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated now() function #2

Merged
merged 1 commit into from
Jan 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/qiniu/fop/image.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ defmodule Qiniu.Fop.Image do
HTTP.get image_url <> params
end

def watermark(type, image_url, text, opts \\ [])
def watermark(:text, image_url, text, opts) do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good for generating the doc, so I think it's better to keep this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will cause the CompileError.

valid_opts = Keyword.take(opts, [:font, :font_size, :fill, :dissolve, :gravity, :dx, :dy])
params = Enum.map_join(valid_opts, "/", fn {k, v} ->
Expand Down
12 changes: 11 additions & 1 deletion lib/qiniu/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ defmodule Qiniu.Utils do
end

defp current_seconds do
{mega, sec, _} = :erlang.now
{mega, sec, _} = current_time

mega * 1_000_000 + sec
end

defp current_time do
case List.to_integer(:erlang.system_info(:otp_release)) do
18 ->
:os.timestamp
true ->
:erlang.now
end
end
end