philomena/lib/philomena_web/views/layout_view.ex

16 lines
318 B
Elixir
Raw Normal View History

2019-08-15 02:32:32 +02:00
defmodule PhilomenaWeb.LayoutView do
use PhilomenaWeb, :view
2019-08-16 02:28:12 +02:00
def render_time(conn) do
(Time.diff(Time.utc_now(), conn.assigns[:start_time], :microsecond) / 1000.0)
|> Float.round(3)
|> Float.to_string()
end
2019-08-18 02:43:44 +02:00
def hostname() do
{:ok, host} = :inet.gethostname()
2019-08-18 18:17:05 +02:00
2019-08-18 02:43:44 +02:00
host |> to_string
end
2019-08-15 02:32:32 +02:00
end