@@ -1087,21 +1087,14 @@ Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"AppStore"}, m_n
|
||||
// check the date, if older than 1day, then fetch new file
|
||||
// this relaxes the spam to their server, don't want to fetch repo
|
||||
// every time the user opens the app!
|
||||
const auto time_file = (time_t)time_stamp.created;
|
||||
const auto time_cur = (time_t)current_time;
|
||||
const auto tm_file = *gmtime(&time_file);
|
||||
const auto tm_cur = *gmtime(&time_cur);
|
||||
if (tm_cur.tm_yday > tm_file.tm_yday || tm_cur.tm_year > tm_file.tm_year) {
|
||||
log_write("repo.json expired, downloading new! cur_yday: %d file_yday: %d | cur_year: %d file_year: %d\n", tm_cur.tm_yday, tm_file.tm_yday, tm_cur.tm_year, tm_file.tm_year);
|
||||
const auto time_file = time_stamp.created;
|
||||
const auto time_cur = current_time;
|
||||
const auto day = 60 * 60 * 24;
|
||||
if (time_file > time_cur || time_cur - time_file >= day) {
|
||||
log_write("repo.json expired, downloading new! time_file: %zu time_cur: %zu\n", time_file, time_cur);
|
||||
download_file = true;
|
||||
} else {
|
||||
log_write("repo.json not expired! cur_yday: %d file_yday: %d | cur_year: %d file_year: %d\n", tm_cur.tm_yday, tm_file.tm_yday, tm_cur.tm_year, tm_file.tm_year);
|
||||
// time_file = (time_t)time_stamp.modified;
|
||||
// tm_file = *gmtime(&time_file);
|
||||
// log_write("repo.json not expired! cur_yday: %d file_yday: %d | cur_year: %d file_year: %d\n", tm_cur.tm_yday, tm_file.tm_yday, tm_cur.tm_year, tm_file.tm_year);
|
||||
// time_file = (time_t)time_stamp.accessed;
|
||||
// tm_file = *gmtime(&time_file);
|
||||
// log_write("repo.json not expired! cur_yday: %d file_yday: %d | cur_year: %d file_year: %d\n", tm_cur.tm_yday, tm_file.tm_yday, tm_cur.tm_year, tm_file.tm_year);
|
||||
log_write("repo.json not expired! time_file: %zu time_cur: %zu\n", time_file, time_cur);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -791,8 +791,9 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
|
||||
}
|
||||
}
|
||||
const auto t = (time_t)(e.time_stamp.modified);
|
||||
const auto tm = gmtime(&t);
|
||||
gfx::drawTextArgs(vg, x + w - text_xoffset, y + (h / 2.f) + 3, 16.f, NVG_ALIGN_RIGHT | NVG_ALIGN_TOP, theme->elements[text_id].colour, "%02u/%02u/%u", tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900);
|
||||
struct tm tm{};
|
||||
localtime_r(&t, &tm);
|
||||
gfx::drawTextArgs(vg, x + w - text_xoffset, y + (h / 2.f) + 3, 16.f, NVG_ALIGN_RIGHT | NVG_ALIGN_TOP, theme->elements[text_id].colour, "%02u/%02u/%u", tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
|
||||
if ((double)e.file_size / 1024.0 / 1024.0 <= 0.009) {
|
||||
gfx::drawTextArgs(vg, x + w - text_xoffset, y + (h / 2.f) - 3, 16.f, NVG_ALIGN_RIGHT | NVG_ALIGN_BOTTOM, theme->elements[text_id].colour, "%.2f KiB", (double)e.file_size / 1024.0);
|
||||
} else {
|
||||
|
||||
@@ -32,12 +32,9 @@ void MenuBase::Draw(NVGcontext* vg, Theme* theme) {
|
||||
u32 strength{};
|
||||
u32 ip{};
|
||||
|
||||
const auto _time = time(NULL);
|
||||
const auto t = time(NULL);
|
||||
struct tm tm{};
|
||||
const auto gmt = gmtime(&_time);
|
||||
if (gmt) {
|
||||
tm = *gmt;
|
||||
}
|
||||
localtime_r(&t, &tm);
|
||||
|
||||
// todo: app thread poll every 1s and this query the result
|
||||
psmGetBatteryChargePercentage(&battery_percetange);
|
||||
|
||||
Reference in New Issue
Block a user