add CTS local time characteristic and use it to provide UTC in DateTimeController

This commit is contained in:
uli
2022-05-28 14:33:04 +02:00
committed by JF
parent 840aab7f90
commit 38092fcb40
6 changed files with 159 additions and 54 deletions

View File

@@ -36,6 +36,7 @@ void DateTime::SetTime(uint16_t year,
/* .tm_mon = */ month - 1,
/* .tm_year = */ year - 1900,
};
tm.tm_isdst = -1; // Use DST value from local time zone
currentDateTime = std::chrono::system_clock::from_time_t(std::mktime(&tm));
@@ -50,6 +51,11 @@ void DateTime::SetTime(uint16_t year,
systemTask->PushMessage(System::Messages::OnNewTime);
}
void DateTime::SetTimeZone(uint8_t timezone, uint8_t dst) {
tzOffset = timezone;
dstOffset = dst;
}
void DateTime::UpdateTime(uint32_t systickCounter) {
// Handle systick counter overflow
uint32_t systickDelta = 0;