Files
MuditaOS/module-utils/time
Mateusz Grzegorzek d87c69479f [EGD-5311] Create Date&Time main window
- add DateAndTimeSettings class and
  dateAndTimeSettings global var
  (cache for storing date and time related settings),
- add DateAndTimeChangeRequest messages and proper
  methods in app::manager::Controller for sending them,
- handle DateAndTimeChangeRequest messages in ApplicationManager,
- add SettingRightItem::Text case for OptionSettings
  to provide possibility to add text
  on the right side of particular option,
- rename fields in db (settings_tab table):
  gs_time_format_12 to gs_time_format
  and
  gs_time_date_format to gs_date_format
- create only main Date&Time window.
  Sub windows will be added in separate task.
2021-02-03 10:11:56 +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