           Map.put(record, :entries, entries)))
   end
 
-  def log_inactive(user) do
-    now = DateTime.utc_now
+  def log_inactive(user, timestamp \\ DateTime.utc_now) do
     record = get_user_record(user)
 
     entries = case record.entries do
                 [] -> []
-                [{b, _} | rest] -> [{b, now} | rest]
+                [{b, _} | rest] -> [{b, timestamp} | rest]
               end
 
     Agent.update(__MODULE__, &Map.put(&1, user,


        [{b, e} | rest] ->
        # Being inactive < 5 minutes just merges into one record
        if Timex.diff(now, e, :minutes) < 5 do
          [{b, nil} | rest]
        else
          [{now, nil}, {b, e} | rest]
        end
      end


    |> Enum.into(%{})
  end

  def log_active(user, timestamp \\ DateTime.utc_now) do
    record = get_user_record(user)

    unless record[:meta] do
