Index: apps/Makefile
===================================================================
--- apps/Makefile	(revision 12752)
+++ apps/Makefile	(working copy)
@@ -54,7 +54,7 @@
    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)\"
 
Index: apps/menus/settings_menu.c
===================================================================
--- apps/menus/settings_menu.c	(revision 12752)
+++ apps/menus/settings_menu.c	(working copy)
@@ -186,7 +186,7 @@
 
 /* Time & Date */
 #ifdef CONFIG_RTC
-static int timedate_set(void)
+int timedate_set(void)
 {
     struct tm tm;
     int result;
@@ -198,14 +198,20 @@
     /* 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);
Index: apps/root_menu.c
===================================================================
--- apps/root_menu.c	(revision 12752)
+++ apps/root_menu.c	(working copy)
@@ -30,6 +30,7 @@
 #include "misc.h"
 #include "rolo.h"
 #include "powermgmt.h"
+#include "settings_menu.h"
 
 #if LCD_DEPTH > 1
 #include "backdrop.h"
@@ -396,6 +397,11 @@
     if (global_settings.start_in_screen == 0)
         ret_val = (int)global_status.last_screen;
     else ret_val = global_settings.start_in_screen - 2;
+
+#ifdef CONFIG_RTC
+    if(!valid_time(get_time()))
+        timedate_set();
+#endif
     
 #ifdef HAVE_RTC_ALARM
     if ( rtc_check_alarm_started(true) ) 
Index: apps/settings_menu.h
===================================================================
--- apps/settings_menu.h	(revision 12752)
+++ apps/settings_menu.h	(working copy)
@@ -23,5 +23,6 @@
 
 bool settings_menu(void);
 bool manage_settings_menu(void);
+int timedate_set(void); 
 
 #endif
