Porting PicoTCP WIP

This commit is contained in:
2025-10-29 14:29:06 +01:00
parent 6722f42e68
commit 815c2239fe
464 changed files with 235009 additions and 24 deletions

View File

@ -136,3 +136,20 @@ void timeunix_totime(timeunix_t unix, Time *time) {
time->month = month + 1;
time->day = (days - month_start) + 1;
}
uint32_t time_totalhours(Time *time) {
uint32_t days = 0;
for (uint32_t y = 1970; y < time->year; y++) {
days += time_isleap(y) ? 366 : 365;
}
days += days_before_month[time->month - 1];
if (time->month > 2 && time_isleap(time->year)) {
days += 1;
}
days += (time->day - 1);
uint32_t total = days * 24 + time->hour;
return total;
}