#include "modules/date.hpp" #include "drawtypes/label.hpp" #include "modules/meta/base.inl" #include "modules/meta/timer_module.inl" POLYBAR_NS namespace modules { template class module; template class timer_module; void date_module::setup() { if (!m_bar.locale.empty()) { setlocale(LC_TIME, m_bar.locale.c_str()); } m_dateformat = string_util::trim(m_conf.get(name(), "date", ""), '"'); m_dateformat_alt = string_util::trim(m_conf.get(name(), "date-alt", ""), '"'); m_timeformat = string_util::trim(m_conf.get(name(), "time", ""), '"'); m_timeformat_alt = string_util::trim(m_conf.get(name(), "time-alt", ""), '"'); if (m_dateformat.empty() && m_timeformat.empty()) { throw module_error("No date or time format specified"); } m_interval = chrono::duration(m_conf.get(name(), "interval", 1.0)); 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 `