mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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
This commit is contained in:
parent
2dc50471ca
commit
ceccec503e
3 changed files with 25 additions and 26 deletions
|
@ -204,28 +204,3 @@ void set_day_of_week(struct tm *tm)
|
||||||
if(m == 0 || m == 1) y--;
|
if(m == 0 || m == 1) y--;
|
||||||
tm->tm_wday = (d + mo[m] + y + y/4 - y/100 + y/400) % 7;
|
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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ struct tm *get_time(void);
|
||||||
int set_time(const struct tm *tm);
|
int set_time(const struct tm *tm);
|
||||||
bool valid_time(const struct tm *tm);
|
bool valid_time(const struct tm *tm);
|
||||||
void set_day_of_week(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
|
#if CONFIG_RTC
|
||||||
time_t mktime(struct tm *t);
|
time_t mktime(struct tm *t);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -295,6 +295,31 @@ static enum {
|
||||||
SENDING_CSW
|
SENDING_CSW
|
||||||
} state = WAITING_FOR_COMMAND;
|
} 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
|
#ifdef TOSHIBA_GIGABEAT_S
|
||||||
|
|
||||||
/* The Gigabeat S factory partition table contains invalid values for the
|
/* The Gigabeat S factory partition table contains invalid values for the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue