Pummpcomm v2.5.1 Pummpcomm.DateDecoder View Source

Decodes Pummpcomm.History and Pummpcomm.Cgm timestamps to NaiveDateTime.t.

Link to this section Summary

Types

A cgm timestamp binary whose format is described in the following table

A history page long timestamp that contains YYY-MM-DD HH::MM

A history short timestamp that contains only YYY-MM-DD

Functions

decodes a cgm timestamp binary whose format is described in the following table

This function decodes a full date and time as returned by the ReadTime command

Decodes either a short or long history page timestamp

Link to this section Types

Link to this type cgm_timestamp() View Source
cgm_timestamp() :: <<_::32>>

A cgm timestamp binary whose format is described in the following table:

+========================================================================+ | BYTE 0 | | 1 | | 2 | | 3 | | MONTH HIGH | HOUR | MONTH LOW | MINUTE | FLAGS | DAY | 2000 + YEAR |

  • —————-+————+—————-+————+———-+———-+——————-+ | xx | 0xxxxx | xx | xxxxxx | xxx | xxxxx | 0xxxxxxx | +========================================================================+
Link to this type history_long_timestamp() View Source
history_long_timestamp() :: <<_::16, _::_*24>>

A history page long timestamp that contains YYY-MM-DD HH::MM

+===================================================================================================+ | BYTE 0 | | 1 | | 2 | | | 3 | 4 | | | MONTH HIGH | SECOND | MONTH LOW | MINUTE | FLAGS | HOUR | FLAGS | DAY | FLAGS | 2000 + YEAR |

  • —————-+————+—————-+————+———-+———-+———-+—————+———-+——————-+ | xx | xxxxxx | xx | xxxxxx | xxx | xxxxx | xxx | xxxxx | x | xxxxxxx | +===================================================================================================+
Link to this type history_short_timestamp() View Source
history_short_timestamp() :: <<_::0>>

A history short timestamp that contains only YYY-MM-DD.

+===========================================+ | BYTE 0 | | 1 | | | MONTH HIGH | DAY | MONTH LOW | YEAR |

  • —————-+————+—————-+————-+ | xxx | xxxxx | x | xxxxxxx | +===========================================+

Link to this section Functions

Link to this function decode_cgm_timestamp(timestamp) View Source
decode_cgm_timestamp(non_neg_integer) :: NaiveDateTime.t
decode_cgm_timestamp(cgm_timestamp) :: NaiveDateTime.t

decodes a cgm timestamp binary whose format is described in the following table:

+========================================================================+ | BYTE 0 | | 1 | | 2 | | 3 | | MONTH HIGH | HOUR | MONTH LOW | MINUTE | FLAGS | DAY | 2000 + YEAR |

  • —————-+————+—————-+————+———-+———-+——————-+ | xx | 0xxxxx | xx | xxxxxx | xxx | xxxxx | 0xxxxxxx | +========================================================================+
Link to this function decode_full_datetime(arg) View Source
decode_full_datetime(binary) ::
  {:ok, NaiveDateTime.t} |
  {:error, :invalid_time}

This function decodes a full date and time as returned by the ReadTime command

Link to this function decode_history_timestamp(timestamp) View Source
decode_history_timestamp(history_short_timestamp) :: NaiveDateTime.t
decode_history_timestamp(history_long_timestamp) :: NaiveDateTime.t

Decodes either a short or long history page timestamp

Long

+===================================================================================================+ | BYTE 0 | | 1 | | 2 | | | 3 | 4 | | | MONTH HIGH | SECOND | MONTH LOW | MINUTE | FLAGS | HOUR | FLAGS | DAY | FLAGS | 2000 + YEAR |

  • —————-+————+—————-+————+———-+———-+———-+—————+———-+——————-+ | xx | xxxxxx | xx | xxxxxx | xxx | xxxxx | xxx | xxxxx | x | xxxxxxx | +===================================================================================================+

Short

+===========================================+ | BYTE 0 | | 1 | | | MONTH HIGH | DAY | MONTH LOW | YEAR |

  • —————-+————+—————-+————-+ | xxx | xxxxx | x | xxxxxxx | +===========================================+