mx6ul_14x14_evk: Avoid overlap of environment over U-Boot proper
[oweals/u-boot.git] / lib / date.c
index 63af4a142612520d728911bd30baedb4e407301d..0456de78ab14ade639c0acecc1bbef25fd7c8338 100644 (file)
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <errno.h>
 #include <rtc.h>
+#include <linux/time.h>
 
 #if defined(CONFIG_LIB_DATE) || defined(CONFIG_TIMESTAMP)
 
@@ -97,3 +98,22 @@ unsigned long rtc_mktime(const struct rtc_time *tm)
 }
 
 #endif /* CONFIG_LIB_DATE || CONFIG_TIMESTAMP */
+
+#ifdef CONFIG_LIB_DATE
+/* for compatibility with linux code */
+time64_t mktime64(const unsigned int year, const unsigned int mon,
+                 const unsigned int day, const unsigned int hour,
+                 const unsigned int min, const unsigned int sec)
+{
+       struct rtc_time time;
+
+       time.tm_year = year;
+       time.tm_mon = mon;
+       time.tm_mday = day;
+       time.tm_hour = hour;
+       time.tm_min = min;
+       time.tm_sec = sec;
+
+       return (time64_t)rtc_mktime((const struct rtc_time *)&time);
+}
+#endif