From 61c12936110fcb45c4c26d2f76f17ffd20954cee Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Mon, 1 Aug 2011 05:11:56 +0200 Subject: [PATCH] Add Timestamp support for filesystem. This took me 3h to debug :-/ --- firmware/filesystem/at45db041d.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/firmware/filesystem/at45db041d.c b/firmware/filesystem/at45db041d.c index 0c6fe37..99b1ff9 100644 --- a/firmware/filesystem/at45db041d.c +++ b/firmware/filesystem/at45db041d.c @@ -236,9 +236,13 @@ DRESULT dataflash_ioctl(BYTE ctrl, void *buff) { } #endif /* _USE_IOCTL != 0 */ - - DWORD get_fattime () { - // ToDo! - return 0; + struct tm* tm=mygmtime(getSeconds()); + DWORD t= (((tm->tm_year+YEAR0-1980)<<9)| + ((tm->tm_mon+1)<<5)| + (tm->tm_mday))<<16 | + ((tm->tm_hour<<11)| + (tm->tm_min<<5)| + (tm->tm_sec>>1)); + return t; }