From f26825d13fd4604af6cac32d93bcc1a21b26e3eb Mon Sep 17 00:00:00 2001 From: bagder Date: Tue, 27 May 2003 13:45:10 +0000 Subject: [PATCH] When we read the year from the RTC, it can be so totally messed up so that we make more than a 4-digit year. Let's not pretend we'll set a year that is beyond 2030. If we do, we know where to fix! ;-) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3699 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/settings.c b/apps/settings.c index 368f05ff9..a6d31341f 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -1707,6 +1707,10 @@ bool set_time(char* string, int timedate[]) while ( !done ) { /* calculate the number of days in febuary */ realyear = timedate[3] + 2000; + + if(realyear > 2030) + realyear = 2003; /* yeah, I believe this is now */ + if((realyear % 4 == 0 && !(realyear % 100 == 0)) || realyear % 400 == 0) daysinmonth[1] = 29; else @@ -1761,8 +1765,8 @@ bool set_time(char* string, int timedate[]) lcd_getstringsize(buffer, &width, &prev_line_height); - snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ", - str(dayname[timedate[6]]), timedate[3], + snprintf(buffer, sizeof(buffer), "%s %04d %s %02d ", + str(dayname[timedate[6]]), realyear, str(monthname[timedate[4] - 1]), timedate[5]); lcd_puts(0, 2, buffer); -- 2.11.4.GIT