summaryrefslogtreecommitdiff
path: root/bsp/simulator/drivers
diff options
context:
space:
mode:
authorprife <[email protected]>2013-03-15 16:58:04 +0800
committerprife <[email protected]>2013-03-15 16:58:04 +0800
commitce612157daaad107ea670e942d9daf50c2710513 (patch)
tree85e34e2165935c8e6a0ec25182afc54a548e20d0 /bsp/simulator/drivers
parent9a80044a55b7eab10b7616dc726ddbd314b52665 (diff)
parentbe59c9287fdcb47984ae0d6b45dbc55bf9719b67 (diff)
Merge branch 'master' of github.com:RT-Thread/rt-thread
Diffstat (limited to 'bsp/simulator/drivers')
-rw-r--r--bsp/simulator/drivers/dfs_win32.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/bsp/simulator/drivers/dfs_win32.c b/bsp/simulator/drivers/dfs_win32.c
index 51f0d295da..32e09f03f7 100644
--- a/bsp/simulator/drivers/dfs_win32.c
+++ b/bsp/simulator/drivers/dfs_win32.c
@@ -1,4 +1,3 @@
-
/*
* File : rtthread.h
* This file is part of RT-Thread RTOS
@@ -11,6 +10,7 @@
* Change Logs:
* Date Author Notes
* 2012-11-27 prife the first version
+ * 2013-03-03 aozima add dfs_win32_stat st_mtime support.
*/
#include <rtthread.h>
@@ -473,7 +473,21 @@ static int dfs_win32_stat(struct dfs_filesystem *fs, const char *path, struct st
st->st_dev = 0;
st->st_size = fileInfo.nFileSizeLow;
- st->st_mtime = 0;
+
+ /* get st_mtime. */
+ {
+ LARGE_INTEGER time_tmp;
+ time_tmp.LowPart = fileInfo.ftLastWriteTime.dwLowDateTime;
+ time_tmp.HighPart = fileInfo.ftLastWriteTime.dwHighDateTime;
+
+ /* removes the diff between 1970 and 1601. */
+ time_tmp.QuadPart -= 11644473600000 * 10000;
+ /* converts back from 100-nanoseconds to seconds. */
+ time_tmp.QuadPart /= 10UL * 1000 * 1000;
+
+ st->st_mtime = time_tmp.QuadPart;
+ }
+
st->st_blksize = 0;
FindClose(hFind);