# `NervesTime.RealTimeClock.BCD`
[🔗](https://github.com/nerves-time/nerves_time/blob/v0.4.10/lib/nerves_time/real_time_clock/bcd.ex#L5)

Convert between integers and binary-coded decimals (BCD)

BCD is commonly used in Real-time clock chips for historical reasons. See
[wikipedia.org/wiki/Binary-coded_decimal](https://en.wikipedia.org/wiki/Binary-coded_decimal)
for a good background on BCD. The BCD implementation here is referred to as
"Packed BCD" in the article.

# `t`

```elixir
@type t() ::
  0..9
  | 16..25
  | 32..41
  | 48..57
  | 64..73
  | 80..89
  | 96..105
  | 112..121
  | 128..137
  | 144..153
```

Support two digit BCD

# `from_integer`

```elixir
@spec from_integer(0..99) :: t()
```

Convert a 8 bit integer value to a BCD binary

# `to_integer`

```elixir
@spec to_integer(t()) :: 0..99
```

Convert an 8 bit bcd-encoded value to an integer

---

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