mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Add conditionals around functions that are only needed when RTC is present.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31301 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
213b8ce74b
commit
871c7bd34c
2 changed files with 6 additions and 0 deletions
|
@ -44,6 +44,7 @@ static void fill_default_tm(struct tm *tm)
|
||||||
}
|
}
|
||||||
#endif /* !CONFIG_RTC */
|
#endif /* !CONFIG_RTC */
|
||||||
|
|
||||||
|
#if CONFIG_RTC
|
||||||
bool valid_time(const struct tm *tm)
|
bool valid_time(const struct tm *tm)
|
||||||
{
|
{
|
||||||
if (tm->tm_hour < 0 || tm->tm_hour > 23 ||
|
if (tm->tm_hour < 0 || tm->tm_hour > 23 ||
|
||||||
|
@ -57,6 +58,7 @@ bool valid_time(const struct tm *tm)
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_RTC */
|
||||||
|
|
||||||
struct tm *get_time(void)
|
struct tm *get_time(void)
|
||||||
{
|
{
|
||||||
|
@ -103,6 +105,7 @@ int set_time(const struct tm *tm)
|
||||||
#endif /* RTC */
|
#endif /* RTC */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_RTC
|
||||||
void set_day_of_week(struct tm *tm)
|
void set_day_of_week(struct tm *tm)
|
||||||
{
|
{
|
||||||
int y=tm->tm_year+1900;
|
int y=tm->tm_year+1900;
|
||||||
|
@ -113,4 +116,5 @@ 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;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_RTC */
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,10 @@
|
||||||
|
|
||||||
struct tm *get_time(void);
|
struct tm *get_time(void);
|
||||||
int set_time(const struct tm *tm);
|
int set_time(const struct tm *tm);
|
||||||
|
#if CONFIG_RTC
|
||||||
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);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _TIMEFUNCS_H_ */
|
#endif /* _TIMEFUNCS_H_ */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue