]> git.sur5r.net Git - u-boot/blobdiff - include/rtc.h
dm: rtc: Rename to_tm() to rtc_to_tm() and add error code
[u-boot] / include / rtc.h
index 54e361ea5e83ee28593dddd8178a361b5e1b53f2..4b7ce6108cfc3f726b4da10bd61d48634780349a 100644 (file)
@@ -45,8 +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 +85,29 @@ 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);
+
+/**
+ * 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_ */