towerops/lib/towerops/time.ex

20 lines
486 B
Elixir

defmodule Towerops.Time do
@moduledoc """
Time utility functions used across the application.
"""
@doc """
Returns the current UTC time truncated to seconds.
This is the standard timestamp format used throughout the application
for consistency with database timestamps and to avoid microsecond precision issues.
## Examples
iex> Towerops.Time.now()
~U[2024-03-15 10:30:45Z]
"""
def now do
DateTime.truncate(DateTime.utc_now(), :second)
end
end