#include "modules/date.hpp" #include "drawtypes/label.hpp" #include "modules/meta/base.inl" POLYBAR_NS namespace modules { template class module; date_module::date_module(const bar_settings& bar, string name_) : timer_module(bar, move(name_)) { if (!m_bar.locale.empty()) { setlocale(LC_TIME, m_bar.locale.c_str()); } m_dateformat = string_util::trim(m_conf.get(name(), "date", ""s), '"'); m_dateformat_alt = string_util::trim(m_conf.get(name(), "date-alt", ""s), '"'); m_timeformat = string_util::trim(m_conf.get(name(), "time", ""s), '"'); m_timeformat_alt = string_util::trim(m_conf.get(name(), "time-alt", ""s), '"'); if (m_dateformat.empty() && m_timeformat.empty()) { throw module_error("No date or time format specified"); } m_interval = m_conf.get(name(), "interval", 1s); m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL, TAG_DATE}); if (m_formatter->has(TAG_DATE)) { m_log.warn("%s: The format tag `` is deprecated, use `