# `Alarmist.Event`
[🔗](https://github.com/nerves-project/alarmist/blob/v0.4.2/lib/alarmist/event.ex#L5)

Struct sent to subscribers on property changes

* `:id` - which alarm
* `:state` - `:set` or `:clear`
* `:description` - alarm description or `nil` when the alarm has been cleared
* `:level` - alarm severity if known to Alarmist. Defaults to `:warning`
* `:timestamp` - the timestamp (`System.monotonic_time/0`) when the changed happened. See `timestamp_to_utc/2` for UTC conversion.
* `:previous_state` - the previous alarm state (`:unknown` if no previous information).
* `:previous_timestamp` - the timestamp when the property changed to `:previous_state`. See `timestamp_to_utc/2` for UTC conversion.

# `t`

```elixir
@type t() :: %Alarmist.Event{
  description: Alarmist.alarm_description(),
  id: Alarmist.alarm_id(),
  level: Logger.level(),
  previous_state: Alarmist.alarm_state(),
  previous_timestamp: integer(),
  state: Alarmist.alarm_state(),
  timestamp: integer()
}
```

# `timestamp_to_utc`

```elixir
@spec timestamp_to_utc(
  integer(),
  {integer(), DateTime.t()}
) :: DateTime.t()
```

Convert the event's monotonic timestamp to UTC

# `utc_conversion`

```elixir
@spec utc_conversion() :: {integer(), DateTime.t()}
```

Returns a monotonic time to UTC time mapping

This is used by `timestamp_to_utc/2` by default, but it's possible to supply
a custom mapping for unit test or performance reasons.

The monotonic time is in native time units.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
