Copyright © (C) 2017-2020, Jan Henry Nystrom <JanHenryNystrom@gmail.com> -------------------------------------------------------------------
Authors: Jan Henry Nystrom (JanHenryNystrom@gmail.com).
A timestamp library based on: Date and Time on the Internet: Timestamps (rfc3339)
The timestamp is represented as follows:
posix : integer()
stamp : #{year => integer(), month => integer(), day => integer(), hour => integer(), minute => integer(), second => integer(), fraction => integer(), offset => Offset } Offset : 'Z' | #{sign => '+' | '-', hours => integer(), minutes => integer()}
The fraction and offset parts are optionalopt() = [seconds | milli | micro | iolist | binary | list | posix]
posix() = integer()
stamp() = #{}
decode/1 | Decodes the binary or posix integer timestamp into a map representing a timestamp. |
decode/2 | Decodes the binary or posix integer timestamp into a map representing a timestamp. |
encode/1 | Encodes the map as an iolist. |
encode/2 | Encodes the Stamp as an iolist or binary. |
gen/0 | Generates the timestamp as an iolist of precision seconds Equivalent of gen([]). |
gen/1 | Generates a timestamp and encode as an iolist, list, binary, or integer posix timestamp. |
Decodes the binary or posix integer timestamp into a map representing a timestamp. Equivalent of decode(Binary, [])
decode(Binary::binary() | posix(), Opts::[opt()] | #opts{precision = seconds | milli | micro, continue = boolean(), return_type = iolist | binary | list | posix}) -> stamp()
Decodes the binary or posix integer timestamp into a map representing a timestamp. Decode will give an exception if the binary is not well formed timestamp. Options are: seconds (default) -> second precision milli -> milli second precision micro -> micro second precision continue -> all remaining indata is returned when decoding a binary
Encodes the map as an iolist. Equivalent of encode(Stamp, [])
encode(Stamp::stamp() | posix(), ParsedOpts::[opt()] | #opts{precision = seconds | milli | micro, continue = boolean(), return_type = iolist | binary | list | posix}) -> iolist() | binary() | list() | posix()
Encodes the Stamp as an iolist or binary. Encode will give an exception if the Stamp is not well formed. Options are: seconds (default) -> second precision (no fraction generated) milli -> milli second precision micro -> micro second precision binary -> a binary is returned list -> a flat list is returned iolist -> an iolist is returned posix -> a posix integer timestamp is returned
gen() -> iolist()
Generates the timestamp as an iolist of precision seconds Equivalent of gen([])
gen(Opts::[opt()] | #opts{precision = seconds | milli | micro, continue = boolean(), return_type = iolist | binary | list | posix}) -> list() | iolist() | binary() | posix()
Generates a timestamp and encode as an iolist, list, binary, or integer posix timestamp. Options are: seconds (default) -> second precision milli -> milli second precision micro -> micro second precision binary -> a binary is returned list -> a flat list is returned iolist (default) -> an iolist is returned posix -> a posix integer timestamp is returned
Generated by EDoc