summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Kukla <roolku@rockbox.org>2007-03-31 13:04:22 +0000
committerRobert Kukla <roolku@rockbox.org>2007-03-31 13:04:22 +0000
commit8f1bc1f00ba230e49281a31036f1f19e455bf54b (patch)
tree2939fd766a2642539f90af1c5683926c8e998097
parenta8aec35d0a13c0d587e0615ca1e06aa79e4bc89a (diff)
downloadrockbox-8f1bc1f00ba230e49281a31036f1f19e455bf54b.zip
rockbox-8f1bc1f00ba230e49281a31036f1f19e455bf54b.tar.gz
rockbox-8f1bc1f00ba230e49281a31036f1f19e455bf54b.tar.bz2
rockbox-8f1bc1f00ba230e49281a31036f1f19e455bf54b.tar.xz
pre-set date fields in time/date screen to build date ( FS#6831 & FS#6939 )
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12982 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/Makefile2
-rw-r--r--apps/menus/settings_menu.c14
2 files changed, 11 insertions, 5 deletions
diff --git a/apps/Makefile b/apps/Makefile
index c63fa82..8fc1bf6 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -54,7 +54,7 @@ ifdef APPEXTRA
INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA)))
endif
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(DEFINES) -DTARGET_ID=$(TARGET_ID) \
+CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(BUILDDATE) $(DEFINES) -DTARGET_ID=$(TARGET_ID) \
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} \
-DTARGET_NAME=\"$(ARCHOS)\"
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 939a2f3..bc253ed 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -202,14 +202,20 @@ static int timedate_set(void)
/* This prevents problems with time/date setting after a power loss */
if (!valid_time(&tm))
{
- /* hour */
+/* 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)
+
tm.tm_hour = 0;
tm.tm_min = 0;
tm.tm_sec = 0;
- tm.tm_mday = 1;
- tm.tm_mon = 0;
+ tm.tm_mday = C2DIG2DEC(DAY);
+ tm.tm_mon = C2DIG2DEC(MONTH)-1;
tm.tm_wday = 1;
- tm.tm_year = 100;
+ tm.tm_year = YEAR-1900;
}
result = (int)set_time_screen(str(LANG_TIME), &tm);