Timestamp Encoding Specification
The Heex SDK excels in Smart Data management using an innovative event-based approach. Each event is given a timestamp, capturing its exact occurrence time. The encoding of these timestamps plays a crucial role in messaging and storage. This page is your go-to guide, detailing the specifications for timestamp encoding in the dynamic realms of messaging and storage.
HeexSDK methods requires timestamps in UTC time.
For example, every timestamp generated by default uses the std::chrono::system_clock::now()
.
Format
HeexSDK uses the ISO 8601-1:2019 standard. It is a string representation of dates and times. The main advantage is the availability of many libraries dealing with this representation.
There are many options, but the format favored by Heex is YYYY-MM-DDThh:mm:ss.ssssssZ
.
YYYY
is the yearMM
is the monthDD
is the dayT
is a separatorhh
is for hoursmm
is for minutesss
is for secondsssssss
(following the dot) is for microsecondsZ
to indicate that we are in UTC+0
Example:
2021-07-07T13:54:05.123456Z
See also this Wikipedia article for more details.
Notes on Usage & Conversion
Heex uses the std::chrono library to generate or read timestamps. Therefore, you need to convert your timestamp if it is stored in Posix, Boost or Unix time (time_t). Some utility functions do exist in the C++ Standard Library (std) to perform the conversion. In addition, some middleware like ROS2 also provide a custom time format that need to be converted.
We also provide custom conversion libraries, that can be found in our HeexUtilsTime.h
file.