Fix error in FAT time (date value was being used)

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4099 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-11-18 12:45:00 +00:00
parent 40acc7c515
commit 8036b2969a
3 changed files with 9 additions and 15 deletions
+3 -1
View File
@@ -2215,4 +2215,6 @@
at all. Some additional special handling is required to initialize the at all. Some additional special handling is required to initialize the
root directory entry to interoperate correctly with windows. root directory entry to interoperate correctly with windows.
* fs/fat/fs_fat32util.c: In fat_systime2fattime(void) should be * fs/fat/fs_fat32util.c: In fat_systime2fattime(void) should be
clock_gettime() and not clock_gettime() (Thanks to David Sidrane). clock_gettime() and not clock_gettime(). Also, there is a place where
FAT date is used instead of FAT time. (Thanks to David Sidrane).
* arch/arm/src/stm32: Add support for the STM3240xxx MCU family.
+1 -9
View File
@@ -16,7 +16,7 @@ nuttx/
(16) Network (net/, drivers/net) (16) Network (net/, drivers/net)
(2) USB (drivers/usbdev, drivers/usbhost) (2) USB (drivers/usbdev, drivers/usbhost)
(7) Libraries (lib/) (7) Libraries (lib/)
(10) File system/Generic drivers (fs/, drivers/) (9) File system/Generic drivers (fs/, drivers/)
(2) Graphics subystem (graphics/) (2) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/) (1) Pascal add-on (pcode/)
(1) Documentation (Documentation/) (1) Documentation (Documentation/)
@@ -501,14 +501,6 @@ o File system / Generic drivers (fs/, drivers/)
Status: Open Status: Open
Priority: Medium Priority: Medium
Description: mkfatfs() does not create the "." directory entry (all directories)
or the ".." directory entry (all directories except for the root
directory). NuttX doesn't care about these entries, but this will
probably make a FAT filesystem formatted on NuttX unusable under
Windows.
Status: Open
Priority: High
o Graphics subystem (graphics/) o Graphics subystem (graphics/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+5 -5
View File
@@ -447,7 +447,7 @@ uint32_t fat_systime2fattime(void)
} }
} }
#endif #endif
return 0; return 0;
} }
/**************************************************************************** /****************************************************************************
@@ -478,9 +478,9 @@ time_t fat_fattime2systime(uint16_t fattime, uint16_t fatdate)
/* Break out the date and time */ /* Break out the date and time */
tm.tm_sec = (fatdate & 0x001f) << 1; /* Bits 0-4: 2 second count (0-29) */ tm.tm_sec = (fattime & 0x001f) << 1; /* Bits 0-4: 2 second count (0-29) */
tm.tm_min = (fatdate & 0x07e0) >> 5; /* Bits 5-10: minutes (0-59) */ tm.tm_min = (fattime & 0x07e0) >> 5; /* Bits 5-10: minutes (0-59) */
tm.tm_hour = (fatdate & 0xf800) >> 11; /* Bits 11-15: hours (0-23) */ tm.tm_hour = (fattime & 0xf800) >> 11; /* Bits 11-15: hours (0-23) */
tm.tm_mday = (fatdate & 0x001f); /* Bits 0-4: Day of month (1-31) */ tm.tm_mday = (fatdate & 0x001f); /* Bits 0-4: Day of month (1-31) */
tmp = ((fatdate & 0x01e0) >> 5); /* Bits 5-8: Month of year (1-12) */ tmp = ((fatdate & 0x01e0) >> 5); /* Bits 5-8: Month of year (1-12) */
@@ -491,7 +491,7 @@ time_t fat_fattime2systime(uint16_t fattime, uint16_t fatdate)
return mktime(&tm); return mktime(&tm);
#else #else
return 0; return 0;
#endif #endif
} }