X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=post%2Fdrivers%2Frtc.c;h=c603f0e6728c9b5922235a2b460b4bb9bfd95c5f;hb=c81b1a8a71fd9a807cbf9aef17f84bec6969a269;hp=e3da5e64ced488cd7b40d9ea4c8009677e447603;hpb=e334e05ba0a6bf38eccadde696cf74b1a52a5021;p=oweals%2Fu-boot.git diff --git a/post/drivers/rtc.c b/post/drivers/rtc.c index e3da5e64ce..c603f0e672 100644 --- a/post/drivers/rtc.c +++ b/post/drivers/rtc.c @@ -1,24 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA */ #include @@ -40,12 +23,10 @@ * nonleap-years. */ -#ifdef CONFIG_POST - #include #include -#if CONFIG_POST & CFG_POST_RTC +#if CONFIG_POST & CONFIG_SYS_POST_RTC static int rtc_post_skip (ulong * diff) { @@ -77,11 +58,10 @@ static int rtc_post_skip (ulong * diff) static void rtc_post_restore (struct rtc_time *tm, unsigned int sec) { - time_t t = mktime (tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, - tm->tm_min, tm->tm_sec) + sec; + time_t t = rtc_mktime(tm) + sec; struct rtc_time ntm; - to_tm (t, &ntm); + rtc_to_tm(t, &ntm); rtc_set (&ntm); } @@ -134,10 +114,17 @@ int rtc_post_test (int flags) rtc_get (&svtm); for (i = 0; i < 12; i++) { - time_t t = mktime (ynl, i + 1, daysnl[i], 23, 59, 59); + time_t t; struct rtc_time tm; - to_tm (t, &tm); + tm.tm_year = ynl; + tm.tm_mon = i + 1; + tm.tm_mday = daysnl[i]; + tm.tm_hour = 23; + tm.tm_min = 59; + tm.tm_sec = 59; + t = rtc_mktime(&tm); + rtc_to_tm(t, &tm); rtc_set (&tm); skipped++; @@ -158,10 +145,18 @@ int rtc_post_test (int flags) } for (i = 0; i < 12; i++) { - time_t t = mktime (yl, i + 1, daysl[i], 23, 59, 59); + time_t t; struct rtc_time tm; - to_tm (t, &tm); + tm.tm_year = yl; + tm.tm_mon = i + 1; + tm.tm_mday = daysl[i]; + tm.tm_hour = 23; + tm.tm_min = 59; + tm.tm_sec = 59; + t = rtc_mktime(&tm); + + rtc_to_tm(t, &tm); rtc_set (&tm); skipped++; @@ -194,5 +189,4 @@ int rtc_post_test (int flags) return 0; } -#endif /* CONFIG_POST & CFG_POST_RTC */ -#endif /* CONFIG_POST */ +#endif /* CONFIG_POST & CONFIG_SYS_POST_RTC */