BACnet.Protocol.BACnetTime (bacstack v0.0.1)
View SourceA BACnet Time is used to represent timepoints of the day, but also can represent unspecific timepoints, such as a single component being unspecified (i.e. can match anything in that component).
This module provides some helpers to convert Time
into a BACnetTime
and back.
Summary
Functions
Compares two BACnet Time.
Encodes the given BACnet Time into an application tag.
Converts a Time
into a BACnet Time.
Parses a BACnet Time from BACnet application tags encoding.
Checks whether the given BACnet Time is a specific time value (every component is a numeric value).
Converts a BACnet Time into a Time
.
Bang-version of to_time/1
.
Creates a new BACnet Time with the current UTC time.
Validates whether the given BACnet time is in form valid.
Types
Functions
Compares two BACnet Time.
Returns :gt
if first time is later than the second,
and :lt
for vice versa.
If the two times are equal, :eq
is returned.
Note that this is achieved by converting to Time
and then
comparing them.
@spec encode(t(), Keyword.t()) :: {:ok, BACnet.Protocol.ApplicationTags.encoding_list()} | {:error, term()}
Encodes the given BACnet Time into an application tag.
Converts a Time
into a BACnet Time.
@spec parse(BACnet.Protocol.ApplicationTags.encoding_list()) :: {:ok, {t(), rest :: BACnet.Protocol.ApplicationTags.encoding_list()}} | {:error, term()}
Parses a BACnet Time from BACnet application tags encoding.
Checks whether the given BACnet Time is a specific time value (every component is a numeric value).
Converts a BACnet Time into a Time
.
If any of the fields are unspecified, the reference time (current UTC value) is used.
Bang-version of to_time/1
.
@spec utc_now() :: t()
Creates a new BACnet Time with the current UTC time.
Validates whether the given BACnet time is in form valid.
It only validates the struct is valid as per type specification.