diff options
author | Simon Glass <sjg@chromium.org> | 2015-04-20 12:37:18 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-05-05 20:58:20 -0600 |
commit | 9f9276c34cbbf67fd1b3788f0be326b47fc69123 (patch) | |
tree | 90e621bf20886ea798cddeae809422c530af476a /include | |
parent | 199e87c340bdd69a89e22f12e1201d67767e91a8 (diff) |
dm: rtc: Rename to_tm() to rtc_to_tm() and add error code
Rename this function so that it is clear that it is provided by the RTC.
Also return an error when it cannot function as expected. This is unlikely
to occur since it works for dates since 1752 and many RTCs do not support
such old dates. Still it is better to be accurate.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/rtc.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/rtc.h b/include/rtc.h index 96c696ad65b..4b7ce6108cf 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -45,7 +45,6 @@ int rtc_get (struct rtc_time *); int rtc_set (struct rtc_time *); void rtc_reset (void); -void to_tm (int, struct rtc_time *); unsigned long mktime (unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); @@ -97,4 +96,18 @@ void rtc_init(void); */ int rtc_calc_weekday(struct rtc_time *time); +/** + * rtc_to_tm() - Convert a time_t value into a broken-out time + * + * The following fields are set up by this function: + * tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, tm_wday + * + * Note that tm_yday and tm_isdst are set to 0. + * + * @time_t: Number of seconds since 1970-01-01 00:00:00 + * @time: Place to put the broken-out time + * @return 0 if OK, -EINVAL if the weekday could not be determined + */ +int rtc_to_tm(int time_t, struct rtc_time *time); + #endif /* _RTC_H_ */ |