1 | #include <time.h> |
---|---|
2 | #include "lib/oofatfs/ff.h" |
3 | |
4 | DWORD get_fattime(void) { |
5 | time_t now = time(NULL); |
6 | struct tm *tm = localtime(&now); |
7 | return ((1900 + tm->tm_year - 1980) << 25) |
8 | | ((tm->tm_mon + 1) << 21) |
9 | | (tm->tm_mday << 16) |
10 | | (tm->tm_hour << 11) |
11 | | (tm->tm_min << 5) |
12 | | (tm->tm_sec / 2); |
13 | } |
14 |