diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2005-09-06 18:03:50 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2005-09-06 18:03:50 +0000 |
| commit | b2964cad0ce00498ec4567eaae7c3db4da7ecbed (patch) | |
| tree | 0dfa183d8307c15ccad75a91b86c3839376ca9b6 | |
| parent | 0172b78995f12ee696783940e29588b957ad5af8 (diff) | |
| download | rockbox-b2964cad0ce00498ec4567eaae7c3db4da7ecbed.zip rockbox-b2964cad0ce00498ec4567eaae7c3db4da7ecbed.tar.gz rockbox-b2964cad0ce00498ec4567eaae7c3db4da7ecbed.tar.bz2 rockbox-b2964cad0ce00498ec4567eaae7c3db4da7ecbed.tar.xz | |
For targets without an RTC, use the rockbox build date as the start date in the FAT driver. No more 2003-08-01 files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7478 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/Makefile | 3 | ||||
| -rw-r--r-- | firmware/drivers/fat.c | 11 | ||||
| -rwxr-xr-x | tools/configure | 1 |
3 files changed, 12 insertions, 3 deletions
diff --git a/firmware/Makefile b/firmware/Makefile index 8e9fad5..1165c26 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -9,7 +9,8 @@ INCLUDES=-Iinclude -I$(FIRMDIR) -Iexport -Icommon -Idrivers -I$(BUILDDIR) -CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} +CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(BUILDDATE) $(EXTRA_DEFINES) \ + -DMEM=${MEMORYSIZE} # This sets up 'SRC' based on the files mentioned in SOURCES include $(TOOLSDIR)/makesrc.inc diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index c11a9f1..7bb2645 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -1059,8 +1059,15 @@ static void fat_time(unsigned short* date, { if (0 == *date) { - /* set to 1 August 2003 */ - *date = ((2003 - 1980) << 9) | (8 << 5) | 1; +/* Macros to convert a 2-digit string to a decimal constant. + (YEAR), MONTH and DAY are set by the date command, which outputs + DAY as 00..31 and MONTH as 01..12. The leading zero would lead to + misinterpretation as an octal constant. */ +#define S100(x) 1 ## x +#define C2DIG2DEC(x) (S100(x)-100) + /* set to build date */ + *date = ((YEAR - 1980) << 9) | (C2DIG2DEC(MONTH) << 5) + | C2DIG2DEC(DAY); } else { diff --git a/tools/configure b/tools/configure index d34b7e4..eda8166 100755 --- a/tools/configure +++ b/tools/configure @@ -814,6 +814,7 @@ export BUILDDIR=@PWD@ export LANGUAGE=@LANGUAGE@ export MEMORYSIZE=@MEMORY@ export VERSION=\$(shell date +%y%m%d-%H%M) +export BUILDDATE=\$(shell date +'-DYEAR=%Y -DMONTH=%m -DDAY=%d') export MKFIRMWARE=@TOOL@ export BINARY=@OUTPUT@ export APPEXTRA=@APPEXTRA@ |