summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-05-27 13:45:10 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-05-27 13:45:10 +0000
commit9c76ee92aa54f9309bbece73031e0f356fdf8821 (patch)
tree3f17800f1335efb65d65e77e034fb3c32f9461b0 /apps
parent364de2c13f3cbc13d73d20841f5c7d928ad57b92 (diff)
downloadrockbox-9c76ee92aa54f9309bbece73031e0f356fdf8821.tar.gz
rockbox-9c76ee92aa54f9309bbece73031e0f356fdf8821.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/settings.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 368f05ff9e..a6d31341f8 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1707,6 +1707,10 @@ bool set_time(char* string, int timedate[])
1707 while ( !done ) { 1707 while ( !done ) {
1708 /* calculate the number of days in febuary */ 1708 /* calculate the number of days in febuary */
1709 realyear = timedate[3] + 2000; 1709 realyear = timedate[3] + 2000;
1710
1711 if(realyear > 2030)
1712 realyear = 2003; /* yeah, I believe this is now */
1713
1710 if((realyear % 4 == 0 && !(realyear % 100 == 0)) || realyear % 400 == 0) 1714 if((realyear % 4 == 0 && !(realyear % 100 == 0)) || realyear % 400 == 0)
1711 daysinmonth[1] = 29; 1715 daysinmonth[1] = 29;
1712 else 1716 else
@@ -1761,8 +1765,8 @@ bool set_time(char* string, int timedate[])
1761 1765
1762 lcd_getstringsize(buffer, &width, &prev_line_height); 1766 lcd_getstringsize(buffer, &width, &prev_line_height);
1763 1767
1764 snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d ", 1768 snprintf(buffer, sizeof(buffer), "%s %04d %s %02d ",
1765 str(dayname[timedate[6]]), timedate[3], 1769 str(dayname[timedate[6]]), realyear,
1766 str(monthname[timedate[4] - 1]), timedate[5]); 1770 str(monthname[timedate[4] - 1]), timedate[5]);
1767 lcd_puts(0, 2, buffer); 1771 lcd_puts(0, 2, buffer);
1768 1772