Files
MuditaOS/module-utils/time
kkleczkowski e4b7e9202e Egd 2507 settings date (#164)
* [EGD-2507] Wip on Date and Time window.

* [EGD-2507] Utlis, timeDateFormat in settings.db.

* [EGD-2507] - WiP on DateTimeWindow.

* [EGD-2507] dateTimeWindow layout + time validation + database_v2.md update.

* [EGD-2507] Code clean-up.

* [EGD-2507] Fixes after rebase, unused include removed.

* [ EGD-2507 ] PR suggestions.

* [ EGD-2507 ] Fixed missing 0 minutes, pr suggestions.

* [EGD-2507-settings-date] Fixes after rebase.
2020-03-05 14:32:06 +01:00
..

Time conversion utility

Why?

  • There is no locale except C-Locale available in stdlib nano and we need time conversions.
  • stdlibnano doesn't provide a way to sustitute C-Locale (it's static)

How?

There is C-Locale builtin, therefore it's used to convert time whenever possible.
When it's not -> specifiers are substituted with our locale (i18 map)

    +------------+     +--------+
    |  Timestamp | <=> | Locale |
    +------------+     +--------+
          *
          |
    +------------+
    |  DateTime  |
    +------------+
        *     *
       /       \
      /         \
 +------+     +------+
 | Time |     | Date |
 +------+     +------+

Locale - (utils::time::Locale) class for i18n Timestamp internationalization management
Timestamp - general class to store time data. Init with a EPOCH timestamp. Has input and output formatters.
DateTime - class for most of possible usecases, initialized with system clock, can return time/date string in reference to past Date - just a subclass with a default formatter returning the date in particular Time - just a subclass with a default formatter returning the time, regardless of the date (today/yesterday/5 days ago)

For more see headers