Try to fix and add logging for date handling
This commit is contained in:
parent
ea62510eb6
commit
b002fddc29
@ -39,7 +39,8 @@ void Agenda::Refresh() {
|
||||
auto todayDate = floor<date::days>(now);
|
||||
auto nowTimePart = make_time(now - todayDate);
|
||||
|
||||
//NRF_LOG_INFO("date %s", todayDate);
|
||||
auto todayYmd = year_month_day(todayDate);
|
||||
NRF_LOG_INFO("date CURRENT %d-%u-%u %ldh%ldh%ld", (int) todayYmd.year(), (unsigned) todayYmd.month(), (unsigned) todayYmd.day(), nowTimePart.hours().count(), nowTimePart.minutes().count(), nowTimePart.seconds().count());
|
||||
|
||||
//std::cout << todayDate << ' ' << nowTimePart << '\n';
|
||||
|
||||
@ -56,16 +57,21 @@ void Agenda::Refresh() {
|
||||
auto timestamp = std::chrono::system_clock::time_point{time * 1s};
|
||||
auto agendaDate = floor<days>(timestamp);
|
||||
auto agendaTimePart = make_time(timestamp - agendaDate);
|
||||
auto ymd = year_month_day(agendaDate);
|
||||
//std::cout << agendaDate << ' ' << agendaTimePart << '\n';
|
||||
|
||||
/*std::time_t result = std::time(nullptr);
|
||||
std::time_t result = std::time(nullptr);
|
||||
std::chrono::time_point = */;
|
||||
|
||||
NRF_LOG_INFO("unix IDX%u %lld", itemIdx, time);
|
||||
NRF_LOG_INFO("date IDX%u %d-%u-%u %ldh%ldh%ld", itemIdx, (int) ymd.year(), (unsigned) ymd.month(), (unsigned) ymd.day(), agendaTimePart.hours().count(), agendaTimePart.minutes().count(), agendaTimePart.seconds().count());
|
||||
NRF_LOG_INFO("item IDX%u %s", itemIdx, agendaSvc.getAgendaPiece(itemIdx).data());
|
||||
|
||||
if (agendaDate == todayDate) {
|
||||
lv_label_set_text_fmt(agendaItem, "%02dh%02d\n %s", agendaTimePart.hours(), agendaTimePart.minutes(), agendaSvc.getAgendaPiece(itemIdx).data());
|
||||
lv_label_set_text_fmt(agendaItem, "%02lldh%02lld\n %s", agendaTimePart.hours().count(), agendaTimePart.minutes().count(), agendaSvc.getAgendaPiece(itemIdx).data());
|
||||
} else {
|
||||
auto ymd = year_month_day(agendaDate);
|
||||
lv_label_set_text_fmt(agendaItem, "%04d-%02d-%02d %02dh%02d\n %s", ymd.year(), ymd.month(), ymd.day(), agendaTimePart.hours(), agendaTimePart.minutes(), agendaSvc.getAgendaPiece(itemIdx).data());
|
||||
lv_label_set_text_fmt(agendaItem, "%04d-%02u-%02u %02lldh%02lld\n %s", (int) ymd.year(), (unsigned) ymd.month(), (unsigned) ymd.day(), agendaTimePart.hours().count(), agendaTimePart.minutes().count(), agendaSvc.getAgendaPiece(itemIdx).data());
|
||||
}
|
||||
|
||||
if (timestamp + 30min < now) {
|
||||
|
Loading…
Reference in New Issue
Block a user