summaryrefslogtreecommitdiffstatshomepage
path: root/ports/unix/fatfs_port.c
blob: 9e0f444ce25769675ba80b4af85c88e7211eaea5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <time.h>
#include "lib/oofatfs/ff.h"

DWORD get_fattime(void) {
    time_t now = time(NULL);
    struct tm *tm = localtime(&now);
    return ((1900 + tm->tm_year - 1980) << 25)
           | ((tm->tm_mon + 1) << 21)
           | (tm->tm_mday << 16)
           | (tm->tm_hour << 11)
           | (tm->tm_min << 5)
           | (tm->tm_sec / 2);
}