It's a little shortcut but it's the most used method in all the `utils.ex` 
of my projects.

  @doc """
  Returns the current datetime in Unix time.

  It will return the integer with the given unit, according to 
`System.convert_time_unit/3`.
  """
  @spec now_unix(System.time_unit) :: integer
  def now_unix(unit \\ :second) do
    DateTime.utc_now() |> DateTime.to_unix(unit)
  end

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/37c433b7-ee09-4052-911c-f58e2904be14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to