Daylight Savings Time support (#1793)

* Daylight Savings Time support

* Cleanup

* Clean-up

* Revert ADSB change

* Clean-up

* Corrected date in comment, ironically
This commit is contained in:
Mark Thompson 2024-01-21 12:47:28 -06:00 committed by GitHub
parent aa5d4ad078
commit 5f8e1ef307
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 403 additions and 35 deletions

View file

@ -404,7 +404,7 @@ static void cmd_rtcget(BaseSequentialStream* chp, int argc, char* argv[]) {
(void)argv;
rtc::RTC datetime;
rtcGetTime(&RTCD1, &datetime);
rtc_time::now(datetime);
chprintf(chp, "Current time: %04d-%02d-%02d %02d:%02d:%02d\r\n", datetime.year(), datetime.month(), datetime.day(), datetime.hour(), datetime.minute(), datetime.second());
}
@ -420,11 +420,12 @@ static void cmd_rtcset(BaseSequentialStream* chp, int argc, char* argv[]) {
return;
}
// TODO: additional commands/parameters for DST?
rtc::RTC new_datetime{
(uint16_t)strtol(argv[0], NULL, 10), (uint8_t)strtol(argv[1], NULL, 10),
(uint8_t)strtol(argv[2], NULL, 10), (uint32_t)strtol(argv[3], NULL, 10),
(uint32_t)strtol(argv[4], NULL, 10), (uint32_t)strtol(argv[5], NULL, 10)};
rtcSetTime(&RTCD1, &new_datetime);
rtc_time::set(new_datetime);
chprintf(chp, "ok\r\n");
}