dm: rtc: Rename gregorian day function

Change this function name to something more descriptive. Also return a
failure code if it cannot calculate a correct value.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
Simon Glass 2015-04-20 12:37:17 -06:00
parent c3ec646dde
commit 199e87c340
4 changed files with 20 additions and 5 deletions

View file

@ -45,7 +45,6 @@ int rtc_get (struct rtc_time *);
int rtc_set (struct rtc_time *);
void rtc_reset (void);
void GregorianDay (struct rtc_time *);
void to_tm (int, struct rtc_time *);
unsigned long mktime (unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int);
@ -87,4 +86,15 @@ void rtc_write32(int reg, u32 value);
*/
void rtc_init(void);
/**
* rtc_calc_weekday() - Work out the weekday from a time
*
* This only works for the Gregorian calendar - i.e. after 1752 (in the UK).
* It sets time->tm_wdaay to the correct day of the week.
*
* @time: Time to inspect. tm_wday is updated
* @return 0 if OK, -EINVAL if the weekday could not be determined
*/
int rtc_calc_weekday(struct rtc_time *time);
#endif /* _RTC_H_ */