summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2009-08-11 20:03:59 +0000
committerFrank Gevaerts <frank@gevaerts.be>2009-08-11 20:03:59 +0000
commitceccec503e140ea70c0ac3ecf75c7f45c3fb7a0c (patch)
treef10a8775453386b9fe226cc620c6a4091f763aa8 /firmware
parent2dc50471ca17eaeb24b45abce4c0f8944cd781d5 (diff)
downloadrockbox-ceccec503e140ea70c0ac3ecf75c7f45c3fb7a0c.tar.gz
rockbox-ceccec503e140ea70c0ac3ecf75c7f45c3fb7a0c.tar.bz2
rockbox-ceccec503e140ea70c0ac3ecf75c7f45c3fb7a0c.zip
Move yearday_to_daymonth() to usb_storage.c. It's the only user, this function is pretty specific, and it seems to be the cleanest way to avoid ram usage increases for unrelated targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22259 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/timefuncs.c25
-rw-r--r--firmware/include/timefuncs.h1
-rw-r--r--firmware/usbstack/usb_storage.c25
3 files changed, 25 insertions, 26 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c
index 774fba9ab0..405bce4f5f 100644
--- a/firmware/common/timefuncs.c
+++ b/firmware/common/timefuncs.c
@@ -204,28 +204,3 @@ void set_day_of_week(struct tm *tm)
if(m == 0 || m == 1) y--;
tm->tm_wday = (d + mo[m] + y + y/4 - y/100 + y/400) % 7;
}
-
-void yearday_to_daymonth(int yd, int y, int *d, int *m)
-{
- static const char tnl[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- static const char tl[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- const char *t;
- int i=0;
-
- if((y%4 == 0 && y%100 != 0) || y%400 == 0)
- {
- t=tl;
- }
- else
- {
- t=tnl;
- }
-
- while(yd >= t[i] && i<12)
- {
- yd-=t[i];
- i++;
- }
- *d = yd+1;
- *m = i;
-}
diff --git a/firmware/include/timefuncs.h b/firmware/include/timefuncs.h
index e9ef8075ac..ab566d9e5f 100644
--- a/firmware/include/timefuncs.h
+++ b/firmware/include/timefuncs.h
@@ -30,7 +30,6 @@ struct tm *get_time(void);
int set_time(const struct tm *tm);
bool valid_time(const struct tm *tm);
void set_day_of_week(struct tm *tm);
-void yearday_to_daymonth(int yd, int y, int *d, int *m);
#if CONFIG_RTC
time_t mktime(struct tm *t);
#endif
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index a3664b074b..e6a45e613a 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -295,6 +295,31 @@ static enum {
SENDING_CSW
} state = WAITING_FOR_COMMAND;
+static void yearday_to_daymonth(int yd, int y, int *d, int *m)
+{
+ static const char tnl[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ static const char tl[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ const char *t;
+ int i=0;
+
+ if((y%4 == 0 && y%100 != 0) || y%400 == 0)
+ {
+ t=tl;
+ }
+ else
+ {
+ t=tnl;
+ }
+
+ while(yd >= t[i] && i<12)
+ {
+ yd-=t[i];
+ i++;
+ }
+ *d = yd+1;
+ *m = i;
+}
+
#ifdef TOSHIBA_GIGABEAT_S
/* The Gigabeat S factory partition table contains invalid values for the