1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 04:34:43 +04:00

DateTime: fix missing weekday in datetime_timestamp_to_datetime conversion (#3508)

This commit is contained in:
あく
2024-03-11 22:09:39 +09:00
committed by GitHub
parent 4f7eb77071
commit adbe4d44f4
2 changed files with 19 additions and 2 deletions

View File

@@ -71,6 +71,7 @@ void datetime_timestamp_to_datetime(uint32_t timestamp, DateTime* datetime) {
uint32_t seconds_in_day = timestamp % SECONDS_PER_DAY;
datetime->year = EPOCH_START_YEAR;
datetime->weekday = ((days + 3) % 7) + 1;
while(days >= datetime_get_days_per_year(datetime->year)) {
days -= datetime_get_days_per_year(datetime->year);