-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Not sure how much battery this would actually save, but booting would be a little faster. Something like
void setupTime() {
auto dt = M5.Rtc.getDateTime();
if (dt.date.year > 2023) {
struct tm tm = { dt.time.seconds, dt.time.minutes, dt.time.hours, dt.date.date, dt.date.month - 1, dt.date.year - 1900 };
time_t t = mktime(&tm);
struct timeval now = { .tv_sec = t };
settimeofday(&now, NULL);
} else {
configTime(0, 0, "pool.ntp.org");
struct tm tm;
if (getLocalTime(&tm)) M5.Rtc.setDateTime(tm);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels