Skip to content

Commit

Permalink
set file dates to the current date
Browse files Browse the repository at this point in the history
  • Loading branch information
g3gg0 committed Oct 3, 2023
1 parent 93e60ed commit a433207
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,18 @@ size_t esp32_wl_translate(const struct wl_state *state, size_t sector)

DWORD get_fattime()
{
uint32_t year = 2023;
uint32_t mon = 7;
uint32_t day = 31;
return ((uint32_t)(year - 1980) << 25 | (uint32_t)mon << 21 | (uint32_t)day << 16);
// Retrieve current time
time_t time = getCurrentUnixTime();
DateTime date;
convertUnixTimeToDate(time, &date);

return (
(uint32_t)(date.year - 1980) << 25 |
(uint32_t)(date.month) << 21 |
(uint32_t)(date.day) << 16 |
(uint32_t)(date.hours) << 11 |
(uint32_t)(date.minutes) << 5 |
(uint32_t)(date.seconds) >> 1);
}

DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
Expand Down

0 comments on commit a433207

Please sign in to comment.