xref: /linux/arch/mips/include/asm/mc146818-time.h (revision 22c55fb9eb92395d999b8404d73e58540d11bdd8)
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Machine dependent access functions for RTC registers.
7  */
8 #ifndef __ASM_MC146818_TIME_H
9 #define __ASM_MC146818_TIME_H
10 
11 #include <linux/mc146818rtc.h>
12 #include <linux/time.h>
13 
14 #ifdef CONFIG_RTC_MC146818_LIB
15 static inline time64_t mc146818_get_cmos_time(void)
16 {
17 	struct rtc_time tm;
18 
19 	if (mc146818_get_time(&tm, 1000)) {
20 		pr_err("Unable to read current time from RTC\n");
21 		return 0;
22 	}
23 
24 	return rtc_tm_to_time64(&tm);
25 }
26 #endif /* CONFIG_RTC_MC146818_LIB */
27 
28 #endif /* __ASM_MC146818_TIME_H */
29