Would it make sense to add support to datetime.c/h to convert to and
from ISO8601 timestamps, which are much more convenient to display since
you can use a struct like this to print the values directly in the
shell, etc.:
typedef struct ATTR_PACKED
{
char year[4]; /**< Year */
char dash1; /**< Dash1 */
char month[2]; /**< Month */
char dash2; /**< Dash2 */
char day[2]; /**< Day */
char T; /**< T */
char hour[2]; /**< Hour */
char colon1; /**< Colon1 */
char minute[2]; /**< Minute */
char colon2; /**< Colon2 */
char second[2]; /**< Second */
char decimal; /**< Decimal */
char sub_second[6]; /**< Sub-second */
char Z; /**< UTC timezone */
char nullterm; // not part of the format, make printf easier
} iso8601_time_t;
* Ignore the typedef etc. which breaks the mynewt rules, this is copied
from another project.
Maybe something like *_to_iso8601 and iso8601_to_*, converting between
epoch and iso8601 etc.
This just has the advantage of being able to print human readable
timestamps in a well-defined format: https://en.wikipedia.org/wiki/ISO_8601
The way the typedef is formatted above means you can just print data
directly and get something like this: *2016-11-08T07:24:30.123456Z*
which can in turn be understand by most other systems.
Just curious if this adds enough value to be included or if epoch is
generally preferable as the sole time keeping units in the core codebase.
K.