Lines Matching +full:clock +full:- +full:accuracy

4  * Copyright (C) 1999 Hewlett-Packard Co
10 * clock by using EFI instead of direct bit fiddling. The functionalities are
20 * - Locking is required for safe execution of EFI calls with regards
24 * - provide the API to set/get the WakeUp Alarm (different from the
26 * - SMP testing
27 * - Add module support
67 * returns day of the year [0-365]
72 /* efi_time_t.month is in the [1-12] so, we need -1 */ in compute_yday()
73 return __mon_yday[is_leap(eft->year)][eft->month-1]+ eft->day -1; in compute_yday()
76 * returns day of the week [0-6] 0=Sunday
86 if ( eft->year < 1998 ) { in compute_wday()
88 return -1; in compute_wday()
91 for(y=EFI_RTC_EPOCH; y < eft->year; y++ ) { in compute_wday()
106 eft->year = wtime->tm_year + 1900; in convert_to_efi_time()
107 eft->month = wtime->tm_mon + 1; in convert_to_efi_time()
108 eft->day = wtime->tm_mday; in convert_to_efi_time()
109 eft->hour = wtime->tm_hour; in convert_to_efi_time()
110 eft->minute = wtime->tm_min; in convert_to_efi_time()
111 eft->second = wtime->tm_sec; in convert_to_efi_time()
112 eft->nanosecond = 0; in convert_to_efi_time()
113 eft->daylight = wtime->tm_isdst ? EFI_ISDST: 0; in convert_to_efi_time()
114 eft->timezone = EFI_UNSPECIFIED_TIMEZONE; in convert_to_efi_time()
121 wtime->tm_sec = eft->second; in convert_from_efi_time()
122 wtime->tm_min = eft->minute; in convert_from_efi_time()
123 wtime->tm_hour = eft->hour; in convert_from_efi_time()
124 wtime->tm_mday = eft->day; in convert_from_efi_time()
125 wtime->tm_mon = eft->month - 1; in convert_from_efi_time()
126 wtime->tm_year = eft->year - 1900; in convert_from_efi_time()
128 /* day of the week [0-6], Sunday=0 */ in convert_from_efi_time()
129 wtime->tm_wday = compute_wday(eft); in convert_from_efi_time()
131 /* day in the year [1-365]*/ in convert_from_efi_time()
132 wtime->tm_yday = compute_yday(eft); in convert_from_efi_time()
135 switch (eft->daylight & EFI_ISDST) { in convert_from_efi_time()
137 wtime->tm_isdst = 1; in convert_from_efi_time()
140 wtime->tm_isdst = 0; in convert_from_efi_time()
143 wtime->tm_isdst = -1; in convert_from_efi_time()
172 return -EINVAL; in efi_rtc_ioctl()
184 return -EINVAL; in efi_rtc_ioctl()
190 sizeof (struct rtc_time)) ? - EFAULT : 0; in efi_rtc_ioctl()
194 if (!capable(CAP_SYS_TIME)) return -EACCES; in efi_rtc_ioctl()
198 return -EFAULT; in efi_rtc_ioctl()
208 return status == EFI_SUCCESS ? 0 : -EINVAL; in efi_rtc_ioctl()
212 if (!capable(CAP_SYS_TIME)) return -EACCES; in efi_rtc_ioctl()
216 if ( get_user(enabled, &ewp->enabled) in efi_rtc_ioctl()
217 || copy_from_user(&wtime, &ewp->time, sizeof(struct rtc_time)) ) in efi_rtc_ioctl()
218 return -EFAULT; in efi_rtc_ioctl()
233 return status == EFI_SUCCESS ? 0 : -EINVAL; in efi_rtc_ioctl()
243 if (status != EFI_SUCCESS) return -EINVAL; in efi_rtc_ioctl()
247 if ( put_user(enabled, &ewp->enabled) in efi_rtc_ioctl()
248 || put_user(pending, &ewp->pending)) return -EFAULT; in efi_rtc_ioctl()
252 return copy_to_user(&ewp->time, &wtime, in efi_rtc_ioctl()
253 sizeof(struct rtc_time)) ? -EFAULT : 0; in efi_rtc_ioctl()
255 return -ENOTTY; in efi_rtc_ioctl()
322 "Date : %u-%u-%u\n" in efi_rtc_get_status()
337 "Alarm Date : %u-%u-%u\n" in efi_rtc_get_status()
358 "Accuracy : %u\n" in efi_rtc_get_status()
360 cap.resolution, cap.accuracy, cap.sets_to_zero); in efi_rtc_get_status()
362 return p - buf; in efi_rtc_get_status()
372 len -= off; in efi_rtc_read_proc()
398 return -1; in efi_rtc_init()